![]() |
Raven Core
3.0.0
P2P Digital Currency
|
#include "httpserver.h"#include "chainparamsbase.h"#include "compat.h"#include "util.h"#include "utilstrencodings.h"#include "netbase.h"#include "rpc/protocol.h"#include "sync.h"#include "ui_interface.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <sys/stat.h>#include <signal.h>#include <future>#include <event2/thread.h>#include <event2/buffer.h>#include <event2/util.h>#include <event2/keyvalq_struct.h>#include "support/events.h"Go to the source code of this file.
Classes | |
| class | HTTPWorkItem |
| HTTP request work item. More... | |
| class | WorkQueue< WorkItem > |
| Simple work queue for distributing work over multiple threads. More... | |
| class | WorkQueue< WorkItem >::ThreadCounter |
| RAII object to keep track of number of running worker threads. More... | |
| struct | HTTPPathHandler |
Macros | |
| #define | EVENT_LOG_WARN _EVENT_LOG_WARN |
Functions | |
| bool | InitHTTPServer () |
| Initialize HTTP server. More... | |
| bool | UpdateHTTPServerLogging (bool enable) |
| Change logging level for libevent. More... | |
| bool | StartHTTPServer () |
| Start HTTP server. More... | |
| void | InterruptHTTPServer () |
| Interrupt HTTP server threads. More... | |
| void | StopHTTPServer () |
| Stop HTTP server. More... | |
| struct event_base * | EventBase () |
| Return evhttp event base. More... | |
| void | RegisterHTTPHandler (const std::string &prefix, bool exactMatch, const HTTPRequestHandler &handler) |
| Register handler for prefix. More... | |
| void | UnregisterHTTPHandler (const std::string &prefix, bool exactMatch) |
| Unregister handler for prefix. More... | |
| std::string | urlDecode (const std::string &urlEncoded) |
Variables | |
| struct evhttp * | eventHTTP = nullptr |
| HTTP server. More... | |
| std::vector< HTTPPathHandler > | pathHandlers |
| Handlers for (sub)paths. More... | |
| std::vector< evhttp_bound_socket * > | boundSockets |
| Bound listening sockets. More... | |
| std::thread | threadHTTP |
| std::future< bool > | threadResult |
| #define EVENT_LOG_WARN _EVENT_LOG_WARN |
| struct event_base* EventBase | ( | ) |
Return evhttp event base.
This can be used by submodules to queue timers or custom events.
Definition at line 510 of file httpserver.cpp.
| bool InitHTTPServer | ( | ) |
Initialize HTTP server.
Call this before RegisterHTTPHandler or EventBase().
Definition at line 368 of file httpserver.cpp.
| void InterruptHTTPServer | ( | ) |
Interrupt HTTP server threads.
Definition at line 459 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 652 of file httpserver.cpp.
| bool 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 443 of file httpserver.cpp.
| void StopHTTPServer | ( | ) |
Stop HTTP server.
Definition at line 474 of file httpserver.cpp.
| void UnregisterHTTPHandler | ( | const std::string & | prefix, |
| bool | exactMatch | ||
| ) |
Unregister handler for prefix.
Definition at line 658 of file httpserver.cpp.
| bool UpdateHTTPServerLogging | ( | bool | enable | ) |
Change logging level for libevent.
Removes BCLog::LIBEVENT from logCategories if libevent doesn't support debug logging.
Definition at line 426 of file httpserver.cpp.
| std::string urlDecode | ( | const std::string & | urlEncoded | ) |
Definition at line 672 of file httpserver.cpp.
| std::vector<evhttp_bound_socket *> boundSockets |
Bound listening sockets.
Definition at line 178 of file httpserver.cpp.
| struct evhttp* eventHTTP = nullptr |
HTTP server.
Definition at line 170 of file httpserver.cpp.
| std::vector<HTTPPathHandler> pathHandlers |
Handlers for (sub)paths.
Definition at line 176 of file httpserver.cpp.
| std::thread threadHTTP |
Definition at line 440 of file httpserver.cpp.
| std::future<bool> threadResult |
Definition at line 441 of file httpserver.cpp.
1.8.13