From: Pieter Lexis Date: Fri, 27 Nov 2015 15:56:23 +0000 (+0100) Subject: dnsdist: Add the correct Content-Header for files X-Git-Tag: dnsdist-1.0.0-alpha1~185^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fe20a1c1c5d4e8a2728b25d51e91c817b4330b9c;p=pdns dnsdist: Add the correct Content-Header for files --- diff --git a/pdns/dnsdist-web.cc b/pdns/dnsdist-web.cc index e224fe46e..8eec664b7 100644 --- a/pdns/dnsdist-web.cc +++ b/pdns/dnsdist-web.cc @@ -159,10 +159,19 @@ static void connectionThread(int sock, ComboAddress remote, string password) } 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]); + vector parts; + stringtok(parts, resp.url.path, "."); + if(parts.back() == "html") + resp.headers["Content-Type"] = "text/html"; + else if(parts.back() == "css") + resp.headers["Content-Type"] = "text/css"; + else if(parts.back() == "js") + resp.headers["Content-Type"] = "application/javascript"; resp.status=200; } else if(resp.url.path=="/") { resp.body.assign(g_urlmap["index.html"]); + resp.headers["Content-Type"] = "text/html"; resp.status=200; } else {