]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
recuweb in recursor 4.0 built in
authorbert hubert <bert.hubert@powerdns.com>
Tue, 16 Feb 2016 16:13:59 +0000 (17:13 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Fri, 19 Feb 2016 08:52:02 +0000 (09:52 +0100)
pdns/webserver.cc
pdns/ws-recursor.cc

index 5ccff1f554c2c9cd022ab157a5071ea5d5b069c2..53ca4179adc1f4a5105239f47efbf75f763f4b5d 100644 (file)
@@ -1,6 +1,6 @@
 /*
     PowerDNS Versatile Database Driven Nameserver
-    Copyright (C) 2002-2012  PowerDNS.COM BV
+    Copyright (C) 2002-2016  PowerDNS.COM BV
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License version 2
index ce5d3bd196ea777238d0a10a83f0f74718fc0950..b5777421a9709bc176988b824705c126856f7093 100644 (file)
@@ -1,6 +1,6 @@
 /*
     PowerDNS Versatile Database Driven Nameserver
-    Copyright (C) 2003 - 2014  PowerDNS.COM BV
+    Copyright (C) 2003 - 2016  PowerDNS.COM BV
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License version 2
@@ -38,6 +38,7 @@
 #include "webserver.hh"
 #include "ws-api.hh"
 #include "logger.hh"
+#include "ext/incbin/incbin.h"
 
 extern __thread FDMultiplexer* t_fdm;
 
@@ -375,6 +376,18 @@ static void apiServerCacheFlush(HttpRequest* req, HttpResponse* resp) {
   });
 }
 
+INCBIN(Index, "index.html");
+
+void serveStuff(HttpRequest* req, HttpResponse* resp) 
+{
+  resp->headers["Cache-Control"] = "max-age=86400";
+  resp->headers["Content-Type"] = "text/css";
+
+  resp->body = string((const char*)gIndexData, gIndexSize);
+  resp->status = 200;
+}
+
+
 RecursorWebServer::RecursorWebServer(FDMultiplexer* fdm)
 {
   RecursorControlParser rcp; // inits
@@ -395,6 +408,8 @@ RecursorWebServer::RecursorWebServer(FDMultiplexer* fdm)
   d_ws->registerApiHandler("/api/v1/servers/localhost", &apiServerDetail);
   d_ws->registerApiHandler("/api/v1/servers", &apiServer);
 
+  d_ws->registerWebHandler("/", serveStuff);
+  
   d_ws->go();
 }