16#ifndef LLVM_DEBUGINFOD_HTTPSERVER_H
17#define LLVM_DEBUGINFOD_HTTPSERVER_H
22#ifdef LLVM_ENABLE_HTTPLIB
34struct StreamingHTTPResponse;
50#ifdef LLVM_ENABLE_HTTPLIB
53 httplib::Response &HTTPLibResponse);
54 httplib::Response &HTTPLibResponse;
79typedef std::function<
StringRef(
size_t ,
size_t )>
95bool streamFile(HTTPServerRequest &Request, StringRef FilePath);
100#ifdef LLVM_ENABLE_HTTPLIB
101 std::unique_ptr<httplib::Server> Server;
118 Error bind(
unsigned Port,
const char *HostInterface =
"0.0.0.0");
Base class for user error types.
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
void log(raw_ostream &OS) const override
Print an error message to an output stream.
void setResponse(StreamingHTTPResponse Response)
SmallVector< std::string, 1 > UrlPathMatches
The elements correspond to match groups in the url path matching regex.
An HTTP server which can listen on a single TCP/IP port for HTTP requests and delgate them to the app...
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.
Error listen()
Attempts to listen for requests on the bound port.
static bool isAvailable()
Returns true only if LLVM has been compiled with a working HTTPServer.
void stop()
If the server is listening, stop and unbind the socket.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
std::function< void(HTTPServerRequest &)> HTTPRequestHandler
bool streamFile(HTTPServerRequest &Request, StringRef FilePath)
Sets the response to stream the file at FilePath, if available, and otherwise an HTTP 404 error respo...
std::function< StringRef(size_t, size_t)> HTTPContentProvider
An HTTPContentProvider is called by the HTTPServer to obtain chunks of the streaming response body.
Wraps the content provider with HTTP Status code and headers.
HTTPContentProvider Provider
std::function< void(bool)> CompletionHandler
Called after the response transfer is complete with the success value of the transfer.