link_with: lib_yahttp,
include_directories: include_directories('..'),
)
+
+dep_yahttp_header_only = declare_dependency(
+ include_directories: include_directories('..'),
+)
CLEANFILES += lua.hpp
pdns_recursor_LDADD = \
- $(YAHTTP_LIBS) \
$(JSON11_LIBS) \
$(LIBCRYPTO_LIBS) \
$(BOOST_CONTEXT_LIBS) \
SUBDIRS = \
arc4random \
- yahttp \
json11 \
probds
dep_libssl,
dep_lua,
dep_protozero,
- dep_yahttp,
+ dep_yahttp_header_only,
dep_htmlfiles,
dep_dnstap,
dep_libcurl,
dep_nod,
dep_lua,
dep_protozero,
- dep_yahttp,
+ dep_yahttp_header_only,
dep_json11,
dep_settings,
dep_rust_settings,
}
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 {
_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())));
}
* 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"
#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"
#include "rec-prometheus-gen.h"
};
+#ifndef RUST_WS
+
constexpr bool CHECK_PROMETHEUS_METRICS = false;
static void validatePrometheusMetrics()
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;
resp->setErrorResult("Command '" + command + "' not found", 404);
}
+#ifndef RUST_WS
+
void AsyncServerNewConnectionMT(void* arg)
{
auto* server = static_cast<AsyncServer*>(arg);
}
server->asyncWaitForConnections(d_fdm, [this](const std::shared_ptr<Socket>& socket) { serveConnection(socket); });
}
+#endif // !RUST_WS
void serveRustWeb()
{
#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)
class HttpRequest;
class HttpResponse;
+#if 0
class AsyncServer : public Server
{
public:
private:
std::unique_ptr<AsyncWebServer> d_ws{nullptr};
};
+#endif
* 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"
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
}
_exit(1);
}
+#endif // !RUST_WS
* 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"
#include "credentials.hh"
#include "namespaces.hh"
+#ifndef REST_WS
#include "sstuff.hh"
+#endif
#include "logging.hh"
class HttpRequest : public YaHTTP::Request {
}
};
+#ifndef RUST_WS
+
class Server
{
public:
// Describes the amount of logging the webserver does
WebServer::LogLevel d_loglevel{WebServer::LogLevel::Detailed};
};
+
+#endif // !RUST_WS