mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-13 06:04:42 +02:00
http: enclose libevent-dependent code in a namespace
This commit is a no-op to isolate HTTP methods and objects that depend on libevent. Following commits will add replacement objects and methods in a new namespace for testing and review before switching over the server.
This commit is contained in:
@@ -30,6 +30,8 @@ static const int DEFAULT_HTTP_SERVER_TIMEOUT=30;
|
||||
struct evhttp_request;
|
||||
struct event_base;
|
||||
class CService;
|
||||
|
||||
namespace http_libevent {
|
||||
class HTTPRequest;
|
||||
|
||||
/** Initialize HTTP server.
|
||||
@@ -48,9 +50,10 @@ void StopHTTPServer();
|
||||
|
||||
/** Change logging level for libevent. */
|
||||
void UpdateHTTPServerLogging(bool enable);
|
||||
} // namespace http_libevent
|
||||
|
||||
/** Handler for requests to a certain HTTP path */
|
||||
typedef std::function<void(HTTPRequest* req, const std::string &)> HTTPRequestHandler;
|
||||
typedef std::function<void(http_libevent::HTTPRequest* req, const std::string &)> HTTPRequestHandler;
|
||||
/** Register handler for prefix.
|
||||
* If multiple handlers match a prefix, the first-registered one will
|
||||
* be invoked.
|
||||
@@ -59,6 +62,7 @@ void RegisterHTTPHandler(const std::string &prefix, bool exactMatch, const HTTPR
|
||||
/** Unregister handler for prefix */
|
||||
void UnregisterHTTPHandler(const std::string &prefix, bool exactMatch);
|
||||
|
||||
namespace http_libevent {
|
||||
/** Return evhttp event base. This can be used by submodules to
|
||||
* queue timers or custom events.
|
||||
*/
|
||||
@@ -158,6 +162,7 @@ public:
|
||||
* @param[in] key represents the query parameter of which the value is returned
|
||||
*/
|
||||
std::optional<std::string> GetQueryParameterFromUri(const char* uri, const std::string& key);
|
||||
} // namespace http_libevent
|
||||
|
||||
/** Event class. This can be used either as a cross-thread trigger or as a timer.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user