Bitcoin Core 31.99.0
P2P Digital Currency
Classes | Functions | Variables
http_bitcoin Namespace Reference

Classes

struct  ContentTooLargeError
 Thrown when a request body exceeds MAX_BODY_SIZE (or will exceed, in chunked transfer) so the server can reply with more specific code 413 (content too large) vs general 400 (bad request) More...
 
class  HTTPHeaders
 
class  HTTPRemoteClient
 
class  HTTPRequest
 
class  HTTPResponse
 
class  HTTPServer
 
struct  HTTPVersion
 

Functions

std::optional< std::string > GetQueryParameterFromUri (const std::string_view uri, const std::string_view key)
 
bool InitHTTPServer ()
 Initialize HTTP server. More...
 
void StartHTTPServer ()
 Start HTTP server. More...
 
void InterruptHTTPServer ()
 Interrupt HTTP server threads. More...
 
void StopHTTPServer ()
 Stop HTTP server. More...
 

Variables

constexpr size_t MIN_REQUEST_LINE_LENGTH = std::string_view("GET / HTTP/1.0").size()
 Shortest valid request line, used by libevent in evhttp_parse_request_line() More...
 
constexpr size_t MAX_HEADERS_SIZE {8192}
 Maximum size of each headers line in an HTTP request, also the maximum size of all headers total. More...
 
constexpr uint64_t MAX_BODY_SIZE {32_MiB}
 Maximum size of an HTTP request body. More...
 

Function Documentation

◆ GetQueryParameterFromUri()

std::optional< std::string > http_bitcoin::GetQueryParameterFromUri ( const std::string_view  uri,
const std::string_view  key 
)

Definition at line 636 of file httpserver.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitHTTPServer()

bool http_bitcoin::InitHTTPServer ( )

Initialize HTTP server.

Call this before RegisterHTTPHandler or EventBase().

Definition at line 1202 of file httpserver.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InterruptHTTPServer()

void http_bitcoin::InterruptHTTPServer ( )

Interrupt HTTP server threads.

Definition at line 1255 of file httpserver.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StartHTTPServer()

void http_bitcoin::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 1247 of file httpserver.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StopHTTPServer()

void http_bitcoin::StopHTTPServer ( )

Stop HTTP server.

Definition at line 1267 of file httpserver.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ MAX_BODY_SIZE

constexpr uint64_t http_bitcoin::MAX_BODY_SIZE {32_MiB}
constexpr

Maximum size of an HTTP request body.

Definition at line 80 of file httpserver.h.

◆ MAX_HEADERS_SIZE

constexpr size_t http_bitcoin::MAX_HEADERS_SIZE {8192}
constexpr

Maximum size of each headers line in an HTTP request, also the maximum size of all headers total.

See https://github.com/bitcoin/bitcoin/pull/6859 And libevent http.c evhttp_parse_headers_()

Definition at line 77 of file httpserver.h.

◆ MIN_REQUEST_LINE_LENGTH

constexpr size_t http_bitcoin::MIN_REQUEST_LINE_LENGTH = std::string_view("GET / HTTP/1.0").size()
constexpr

Shortest valid request line, used by libevent in evhttp_parse_request_line()

Definition at line 71 of file httpserver.h.