]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Don't link with yahttp any more (header files still in use)
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 3 Dec 2024 12:31:53 +0000 (13:31 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 11 Feb 2025 15:28:22 +0000 (16:28 +0100)
ext/yahttp/yahttp/meson.build
pdns/recursordist/Makefile.am
pdns/recursordist/ext/Makefile.am
pdns/recursordist/meson.build
pdns/recursordist/rec-main.cc
pdns/recursordist/ws-recursor.cc
pdns/recursordist/ws-recursor.hh
pdns/webserver.cc
pdns/webserver.hh

index 2704d4798cc714dd79b32e2e6142d6e9274bd6b3..b9eb5d570f8a30e2183e7d4380f05948fae1ec06 100644 (file)
@@ -20,3 +20,7 @@ dep_yahttp = declare_dependency(
   link_with: lib_yahttp,
   include_directories: include_directories('..'),
 )
+
+dep_yahttp_header_only = declare_dependency(
+  include_directories: include_directories('..'),
+)
index 0c57de01a5970e08d278617daf873c08de0f3236..488fc8e926c71cd8e774169aa5c9f0e6101272c3 100644 (file)
@@ -252,7 +252,6 @@ endif
 CLEANFILES += lua.hpp
 
 pdns_recursor_LDADD = \
-       $(YAHTTP_LIBS) \
        $(JSON11_LIBS) \
        $(LIBCRYPTO_LIBS) \
        $(BOOST_CONTEXT_LIBS) \
index 65131d0b277e4c834d4cef4d47d3011cfa477cd3..2fb9da054d6f97c1f3fb45a768113f21e98ab22b 100644 (file)
@@ -1,6 +1,5 @@
 SUBDIRS = \
        arc4random \
-       yahttp \
        json11 \
        probds
 
index 81d740568fe5535f090ac493c770ea70ccf31b20..5f276d25fc8ed67d1c28eeec293fd2e7ebe671d4 100644 (file)
@@ -312,7 +312,7 @@ deps = [
   dep_libssl,
   dep_lua,
   dep_protozero,
-  dep_yahttp,
+  dep_yahttp_header_only,
   dep_htmlfiles,
   dep_dnstap,
   dep_libcurl,
@@ -422,7 +422,7 @@ tools = {
       dep_nod,
       dep_lua,
       dep_protozero,
-      dep_yahttp,
+      dep_yahttp_header_only,
       dep_json11,
       dep_settings,
       dep_rust_settings,
index 7dfcec091fd512fdb608f4012c54f1b11f04735b..98dbff074d64d176250c5f49c32accd084be499b 100644 (file)
@@ -2923,13 +2923,14 @@ static void recursorThread()
     }
 
     t_fdm = unique_ptr<FDMultiplexer>(getMultiplexer(log));
-
+#if 0
     std::unique_ptr<RecursorWebServer> rws;
-
+#endif
     t_fdm->addReadFD(threadInfo.getPipes().readToThread, handlePipeRequest);
 
     if (threadInfo.isHandler()) {
-      if (false && ::arg().mustDo("webserver")) {
+#if 0
+      if (::arg().mustDo("webserver")) {
         SLOG(g_log << Logger::Warning << "Enabling web server" << endl,
              log->info(Logr::Info, "Enabling web server"));
         try {
@@ -2941,6 +2942,7 @@ static void recursorThread()
           _exit(99);
         }
       }
+#endif
       SLOG(g_log << Logger::Info << "Enabled '" << t_fdm->getName() << "' multiplexer" << endl,
            log->info(Logr::Info, "Enabled multiplexer", "name", Logging::Loggable(t_fdm->getName())));
     }
index 7de35f61a94eb4d78923e8097aa9d5ab629ff113..3181564100d4a0f2d36c25ac89c33e9b93555178 100644 (file)
@@ -19,9 +19,9 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
-#ifdef HAVE_CONFIG_H
+
 #include "config.h"
-#endif
+
 #include "ws-recursor.hh"
 #include "json.hh"
 
@@ -42,8 +42,6 @@
 #include "logging.hh"
 #include "rec-lua-conf.hh"
 #include "rpzloader.hh"
-#include "uuid-utils.hh"
-#include "tcpiohandler.hh"
 #include "rec-main.hh"
 #include "settings/cxxsettings.hh" // IWYU pragma: keep, needed by included generated file
 #include "settings/rust/src/bridge.hh"
@@ -639,6 +637,8 @@ const std::map<std::string, MetricDefinition> MetricDefinitionStorage::d_metrics
 #include "rec-prometheus-gen.h"
 };
 
+#ifndef RUST_WS
+
 constexpr bool CHECK_PROMETHEUS_METRICS = false;
 
 static void validatePrometheusMetrics()
@@ -719,8 +719,9 @@ RecursorWebServer::RecursorWebServer(FDMultiplexer* fdm)
   d_ws->registerWebHandler("/metrics", prometheusMetrics, "GET");
   d_ws->go();
 }
+#endif // !RUST_WS
 
-void RecursorWebServer::jsonstat(HttpRequest* req, HttpResponse* resp)
+static void jsonstat(HttpRequest* req, HttpResponse* resp)
 {
   string command;
 
@@ -833,6 +834,8 @@ void RecursorWebServer::jsonstat(HttpRequest* req, HttpResponse* resp)
   resp->setErrorResult("Command '" + command + "' not found", 404);
 }
 
+#ifndef RUST_WS
+
 void AsyncServerNewConnectionMT(void* arg)
 {
   auto* server = static_cast<AsyncServer*>(arg);
@@ -978,6 +981,7 @@ void AsyncWebServer::go()
   }
   server->asyncWaitForConnections(d_fdm, [this](const std::shared_ptr<Socket>& socket) { serveConnection(socket); });
 }
+#endif // !RUST_WS
 
 void serveRustWeb()
 {
@@ -1054,11 +1058,7 @@ namespace pdns::rust::web::rec
 #define WRAPPER(A) \
   void A(const Request& rustRequest, Response& rustResponse) { rustWrapper(::A, rustRequest, rustResponse); }
 
-void jsonstat(const Request& rustRequest, Response& rustResponse)
-{
-  rustWrapper(RecursorWebServer::jsonstat, rustRequest, rustResponse);
-}
-
+WRAPPER(jsonstat)
 WRAPPER(apiDiscovery)
 WRAPPER(apiDiscoveryV1)
 WRAPPER(apiServer)
index 18ab40b5b7fc7f10b79d7740469adc64eca2c339..882d29ba4fb3c2841208669305799166cde413fa 100644 (file)
@@ -28,6 +28,7 @@
 class HttpRequest;
 class HttpResponse;
 
+#if 0
 class AsyncServer : public Server
 {
 public:
@@ -75,3 +76,4 @@ public:
 private:
   std::unique_ptr<AsyncWebServer> d_ws{nullptr};
 };
+#endif
index fea0724d538270bc94d3e32eec6fda231c807713..e6595d6fac7fe0e0cfd115d37dba1d069397ba19 100644 (file)
@@ -19,9 +19,9 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
-#ifdef HAVE_CONFIG_H
+
 #include "config.h"
-#endif
+
 #include "utility.hh"
 #include "webserver.hh"
 #include "misc.hh"
@@ -136,6 +136,8 @@ void HttpResponse::setSuccessResult(const std::string& message, const int status
   this->status = status_;
 }
 
+#ifndef RUST_WS
+
 static void bareHandlerWrapper(const WebServer::HandlerFunction& handler, YaHTTP::Request* req, YaHTTP::Response* resp)
 {
   // wrapper to convert from YaHTTP::* to our subclasses
@@ -686,3 +688,4 @@ void WebServer::go()
   }
   _exit(1);
 }
+#endif // !RUST_WS
index e1f3795f691239afce933ca2a2fdcbc421cabd2c..e542bc54f9b1d74fbf59ada2c8865da8d2971305 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 #pragma once
-#include <map>
-#include <string>
-#include <list>
+
+#ifdef RECURSOR
+// Network facing/routing part of webserver is implemented in rust. We stil use a few classes from
+// yahttp, but do not link to it.
+#define RUST_WS
+#endif
+
 #include <boost/utility.hpp>
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Woverloaded-virtual"
@@ -34,7 +38,9 @@
 
 #include "credentials.hh"
 #include "namespaces.hh"
+#ifndef REST_WS
 #include "sstuff.hh"
+#endif
 #include "logging.hh"
 
 class HttpRequest : public YaHTTP::Request {
@@ -159,6 +165,8 @@ public:
   }
 };
 
+#ifndef RUST_WS
+
 class Server
 {
 public:
@@ -300,3 +308,5 @@ protected:
   // Describes the amount of logging the webserver does
   WebServer::LogLevel d_loglevel{WebServer::LogLevel::Detailed};
 };
+
+#endif // !RUST_WS