From: Remi Gacogne Date: Tue, 26 Apr 2016 13:44:16 +0000 (+0200) Subject: dnsdist: Stop copying the request headers to the response X-Git-Tag: rec-4.0.0-alpha3~37^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F3773%2Fhead;p=thirdparty%2Fpdns.git dnsdist: Stop copying the request headers to the response --- diff --git a/pdns/dnsdist-web.cc b/pdns/dnsdist-web.cc index 67e60971b3..4ebda9cfa7 100644 --- a/pdns/dnsdist-web.cc +++ b/pdns/dnsdist-web.cc @@ -87,7 +87,8 @@ static void connectionThread(int sock, ComboAddress remote, string password, str req.getvars.erase("_"); // jQuery cache buster - YaHTTP::Response resp(req); + YaHTTP::Response resp; + resp.version = req.version; const string charset = "; charset=utf-8"; resp.headers["X-Content-Type-Options"] = "nosniff"; resp.headers["X-Frame-Options"] = "deny"; @@ -334,10 +335,10 @@ static void connectionThread(int sock, ComboAddress remote, string password, str resp.body=my_json.dump(); resp.headers["Content-Type"] = "application/json"; } - else if(!resp.url.path.empty() && g_urlmap.count(resp.url.path.c_str()+1)) { - resp.body.assign(g_urlmap[resp.url.path.c_str()+1]); + else if(!req.url.path.empty() && g_urlmap.count(req.url.path.c_str()+1)) { + resp.body.assign(g_urlmap[req.url.path.c_str()+1]); vector parts; - stringtok(parts, resp.url.path, "."); + stringtok(parts, req.url.path, "."); if(parts.back() == "html") resp.headers["Content-Type"] = "text/html" + charset; else if(parts.back() == "css") @@ -348,13 +349,13 @@ static void connectionThread(int sock, ComboAddress remote, string password, str resp.headers["Content-Type"] = "image/png"; resp.status=200; } - else if(resp.url.path=="/") { + else if(req.url.path=="/") { resp.body.assign(g_urlmap["index.html"]); resp.headers["Content-Type"] = "text/html" + charset; resp.status=200; } else { - // cerr<<"404 for: "<