From e3d76be2e663dbffe9dddf7c8ee3caefe4adc251 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 26 Apr 2016 15:44:16 +0200 Subject: [PATCH] dnsdist: Stop copying the request headers to the response --- pdns/dnsdist-web.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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: "<