From cc55a8f2d4ecbe9646f4140616cc34ea82159e02 Mon Sep 17 00:00:00 2001 From: Jan Broer Date: Mon, 18 Jan 2016 02:01:48 +0100 Subject: [PATCH] Don't throw authentication error on the first request a HTTP client sends --- pdns/dnsdist-web.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pdns/dnsdist-web.cc b/pdns/dnsdist-web.cc index e9c2c517a..d40c6eee5 100644 --- a/pdns/dnsdist-web.cc +++ b/pdns/dnsdist-web.cc @@ -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="

Unauthorized

"; resp.headers["WWW-Authenticate"] = "basic realm=\"PowerDNS\""; -- 2.40.0