![]() |
Bitcoin Core 32.99.0
P2P Digital Currency
|
#include <bitcoin-build-config.h>#include <httpserver.h>#include <chainparamsbase.h>#include <common/args.h>#include <common/messages.h>#include <common/url.h>#include <compat/compat.h>#include <logging.h>#include <netbase.h>#include <node/interface_ui.h>#include <rpc/protocol.h>#include <span.h>#include <sync.h>#include <util/check.h>#include <util/signalinterrupt.h>#include <util/sock.h>#include <util/strencodings.h>#include <util/thread.h>#include <util/threadnames.h>#include <util/threadpool.h>#include <util/time.h>#include <util/translation.h>#include <condition_variable>#include <cstdio>#include <cstdlib>#include <memory>#include <optional>#include <span>#include <string>#include <string_view>#include <thread>#include <unordered_map>#include <vector>#include <sys/types.h>#include <sys/stat.h>Go to the source code of this file.
Classes | |
| struct | HTTPPathHandler |
Variables | |
| static constexpr auto | SELECT_TIMEOUT {50ms} |
| The set of sockets cannot be modified while waiting, so the sleep time needs to be small to avoid new sockets stalling. | |
| static constexpr int | SOCKET_OPTION_TRUE {1} |
| Explicit alias for setting socket option methods. | |
| static std::unique_ptr< HTTPServer > | g_http_server {nullptr} |
| HTTP module state. | |
| static GlobalMutex | g_httppathhandlers_mutex |
| Handlers for (sub)paths. | |
| static ThreadPool | g_threadpool_http ("http") |
| Http thread pool - future: encapsulate in HttpContext | |
| static int | g_max_queue_depth {100} |
|
static |
Definition at line 208 of file httpserver.cpp.
| std::optional< std::string > GetQueryParameterFromUri | ( | const std::string_view | uri, |
| const std::string_view | key | ||
| ) |
Definition at line 673 of file httpserver.cpp.
|
static |
| bool InitHTTPServer | ( | ) |
Initialize HTTP server.
Call this before RegisterHTTPHandler or EventBase().
Definition at line 1347 of file httpserver.cpp.
| void InterruptHTTPServer | ( | ) |
Interrupt HTTP server threads.
Definition at line 1401 of file httpserver.cpp.
|
static |
Definition at line 136 of file httpserver.cpp.
| void RegisterHTTPHandler | ( | const std::string & | prefix, |
| bool | exactMatch, | ||
| const HTTPRequestHandler & | handler | ||
| ) |
Register handler for prefix.
If multiple handlers match a prefix, the first-registered one will be invoked.
Definition at line 241 of file httpserver.cpp.
|
static |
Definition at line 202 of file httpserver.cpp.
| std::string_view RequestMethodString | ( | HTTPRequestMethod | m | ) |
HTTP request method as string - use for logging only.
Definition at line 117 of file httpserver.cpp.
| void StartHTTPServer | ( | ) |
Start HTTP server.
This is separate from InitHTTPServer to give users race-condition-free time to register their handlers between InitHTTPServer and StartHTTPServer.
Definition at line 1393 of file httpserver.cpp.
| void StopHTTPServer | ( | ) |
Stop HTTP server.
Definition at line 1413 of file httpserver.cpp.
Unregister handler for prefix.
Definition at line 248 of file httpserver.cpp.
|
static |
|
static |
HTTP module state.
Definition at line 69 of file httpserver.cpp.
|
static |
Handlers for (sub)paths.
Definition at line 71 of file httpserver.cpp.
|
static |
Definition at line 76 of file httpserver.cpp.
|
static |
The set of sockets cannot be modified while waiting, so the sleep time needs to be small to avoid new sockets stalling.
Definition at line 47 of file httpserver.cpp.
Explicit alias for setting socket option methods.
Definition at line 50 of file httpserver.cpp.