//===-- llvm/Debuginfod/HTTPServer.h - HTTP server library ------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// /// /// \file /// This file contains the declarations of the HTTPServer and HTTPServerRequest /// classes, the HTTPResponse, and StreamingHTTPResponse structs, and the /// streamFile function. /// //===----------------------------------------------------------------------===// #ifndef LLVM_DEBUGINFOD_HTTPSERVER_H #define LLVM_DEBUGINFOD_HTTPSERVER_H #include "llvm/ADT/StringRef.h" #include "llvm/Support/Error.h" #ifdef LLVM_ENABLE_HTTPLIB // forward declarations namespace httplib { class Request; class Response; class Server; } // namespace httplib #endif namespace llvm { struct HTTPResponse; struct StreamingHTTPResponse; class HTTPServer; class HTTPServerError : public ErrorInfo<HTTPServerError, ECError> { … }; class HTTPServerRequest { … }; struct HTTPResponse { … }; HTTPRequestHandler; /// An HTTPContentProvider is called by the HTTPServer to obtain chunks of the /// streaming response body. The returned chunk should be located at Offset /// bytes and have Length bytes. HTTPContentProvider; /// Wraps the content provider with HTTP Status code and headers. struct StreamingHTTPResponse { … }; /// Sets the response to stream the file at FilePath, if available, and /// otherwise an HTTP 404 error response. bool streamFile(HTTPServerRequest &Request, StringRef FilePath); /// An HTTP server which can listen on a single TCP/IP port for HTTP /// requests and delgate them to the appropriate registered handler. class HTTPServer { … }; } // end namespace llvm #endif // LLVM_DEBUGINFOD_HTTPSERVER_H