feat: Integrate new webserver (#1722)

For #919.
The new web server is not using dosguard yet. It will be fixed by a
separate PR.
This commit is contained in:
Sergey Kuznetsov
2024-11-21 14:48:32 +00:00
committed by GitHub
parent fc3ba07f2e
commit c77154a5e6
90 changed files with 4029 additions and 683 deletions

View File

@@ -19,8 +19,6 @@
#pragma once
#include "web/interface/ConnectionBase.hpp"
#include <boost/beast.hpp>
#include <boost/beast/core/error.hpp>
@@ -29,6 +27,8 @@
namespace web {
struct ConnectionBase;
/**
* @brief Specifies the requirements a Webserver handler must fulfill.
*/

View File

@@ -20,13 +20,13 @@
#pragma once
#include "util/Taggable.hpp"
#include "web/SubscriptionContextInterface.hpp"
#include <boost/beast/http.hpp>
#include <boost/beast/http/status.hpp>
#include <boost/signals2.hpp>
#include <boost/signals2/variadic_signal.hpp>
#include <cstdint>
#include <memory>
#include <stdexcept>
#include <string>
@@ -49,13 +49,6 @@ protected:
public:
std::string const clientIp;
bool upgraded = false;
boost::signals2::signal<void(ConnectionBase*)> onDisconnect;
/**
* @brief The API version of the web stream client.
* This is used to track the api version of this connection, which mainly is used by subscription. It is different
* from the api version in Context, which is only used for the current request.
*/
std::uint32_t apiSubVersion = 0;
/**
* @brief Create a new connection base.
@@ -68,11 +61,6 @@ public:
{
}
~ConnectionBase() override
{
onDisconnect(this);
};
/**
* @brief Send the response to the client.
*
@@ -94,6 +82,15 @@ public:
throw std::logic_error("web server can not send the shared payload");
}
/**
* @brief Get the subscription context for this connection.
*
* @param factory Tag TagDecoratorFactory to use to create the context.
* @return The subscription context for this connection.
*/
virtual SubscriptionContextPtr
makeSubscriptionContext(util::TagDecoratorFactory const& factory) = 0;
/**
* @brief Indicates whether the connection had an error and is considered dead.
*