]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Do not include built-in HTML content when DISABLE_BUILTIN_HTML is defined
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 8 Nov 2021 16:38:59 +0000 (17:38 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 22 Dec 2021 08:30:43 +0000 (09:30 +0100)
pdns/dnsdist-web.cc

index e3cb116d6e9aad0cbfb1371ba28741626b5e6d7e..52972c20e8c90f2d06736f9fbaf4bcd3687d1c2f 100644 (file)
@@ -38,7 +38,6 @@
 #include "dnsdist-web.hh"
 #include "dolog.hh"
 #include "gettime.hh"
-#include "htmlfiles.h"
 #include "threadname.hh"
 #include "sodcrypto.hh"
 #include "sstuff.hh"
@@ -1369,6 +1368,9 @@ void clearWebHandlers()
   s_webHandlers.clear();
 }
 
+#ifndef DISABLE_BUILTIN_HTML
+#include "htmlfiles.h"
+
 static void redirectToIndex(const YaHTTP::Request& req, YaHTTP::Response& resp)
 {
   const string charset = "; charset=utf-8";
@@ -1403,6 +1405,7 @@ static void handleBuiltInFiles(const YaHTTP::Request& req, YaHTTP::Response& res
 
   resp.status = 200;
 }
+#endif /* DISABLE_BUILTIN_HTML */
 
 void registerBuiltInWebHandlers()
 {
@@ -1415,11 +1418,13 @@ void registerBuiltInWebHandlers()
   registerWebHandler("/api/v1/servers/localhost/statistics", handleStatsOnly);
   registerWebHandler("/api/v1/servers/localhost/config", handleConfigDump);
   registerWebHandler("/api/v1/servers/localhost/config/allow-from", handleAllowFrom);
+#ifndef DISABLE_BUILTIN_HTML
   registerWebHandler("/", redirectToIndex);
 
   for (const auto& path : s_urlmap) {
     registerWebHandler("/" + path.first, handleBuiltInFiles);
   }
+#endif /* DISABLE_BUILTIN_HTML */
 }
 
 static void connectionThread(WebClientConnection&& conn)