]> granicus.if.org Git - pdns/commitdiff
Don't throw authentication error on the first request a HTTP client sends
authorJan Broer <janeczku@yahoo.de>
Mon, 18 Jan 2016 01:01:48 +0000 (02:01 +0100)
committerJan Broer <janeczku@yahoo.de>
Mon, 18 Jan 2016 16:34:54 +0000 (17:34 +0100)
pdns/dnsdist-web.cc

index e9c2c517a36f9d38a9bfbfde1e8f324fed4812c7..d40c6eee5170951fa0fcf1e48052ec331005e2d6 100644 (file)
@@ -88,7 +88,9 @@ static void connectionThread(int sock, ComboAddress remote, string password)
       resp.status=200;
     }
     else if (!compareAuthorization(req, password)) {
-      errlog("HTTP Request \"%s\" from %s: Web Authentication failed", req.url.path, remote.toStringWithPort());
+      YaHTTP::strstr_map_t::iterator header = req.headers.find("authorization");
+      if (header != req.headers.end())
+        errlog("HTTP Request \"%s\" from %s: Web Authentication failed", req.url.path, remote.toStringWithPort());
       resp.status=401;
       resp.body="<h1>Unauthorized</h1>";
       resp.headers["WWW-Authenticate"] = "basic realm=\"PowerDNS\"";