LLVM 20.0.0git
|
An HTTP server which can listen on a single TCP/IP port for HTTP requests and delgate them to the appropriate registered handler. More...
#include "llvm/Debuginfod/HTTPServer.h"
Public Member Functions | |
HTTPServer () | |
~HTTPServer () | |
Error | get (StringRef UrlPathPattern, HTTPRequestHandler Handler) |
Registers a URL pattern routing rule. | |
Error | bind (unsigned Port, const char *HostInterface="0.0.0.0") |
Attempts to assign the requested port and interface, returning an Error upon failure. | |
Expected< unsigned > | bind (const char *HostInterface="0.0.0.0") |
Attempts to assign any available port and interface, returning either the port number or an Error upon failure. | |
Error | listen () |
Attempts to listen for requests on the bound port. | |
void | stop () |
If the server is listening, stop and unbind the socket. | |
Static Public Member Functions | |
static bool | isAvailable () |
Returns true only if LLVM has been compiled with a working HTTPServer. | |
An HTTP server which can listen on a single TCP/IP port for HTTP requests and delgate them to the appropriate registered handler.
Definition at line 99 of file HTTPServer.h.
|
default |
|
default |
Attempts to assign any available port and interface, returning either the port number or an Error upon failure.
Definition at line 186 of file HTTPServer.cpp.
Attempts to assign the requested port and interface, returning an Error upon failure.
Definition at line 182 of file HTTPServer.cpp.
Error HTTPServer::get | ( | StringRef | UrlPathPattern, |
HTTPRequestHandler | Handler | ||
) |
Registers a URL pattern routing rule.
When the server is listening, each request is dispatched to the first registered handler whose UrlPathPattern matches the UrlPath.
Definition at line 175 of file HTTPServer.cpp.
References llvm::Error::success().
Referenced by llvm::DebuginfodServer::DebuginfodServer().
|
static |
Returns true only if LLVM has been compiled with a working HTTPServer.
Definition at line 161 of file HTTPServer.cpp.
Error HTTPServer::listen | ( | ) |
Attempts to listen for requests on the bound port.
Returns an Error if called before binding a port.
Definition at line 190 of file HTTPServer.cpp.
void HTTPServer::stop | ( | ) |
If the server is listening, stop and unbind the socket.
Definition at line 194 of file HTTPServer.cpp.
References llvm_unreachable.