class HTTPServer

Declaration

class HTTPServer { /* full declaration omitted */ };

Description

An HTTP server which can listen on a single TCP/IP port for HTTP requests and delgate them to the appropriate registered handler.

Declared at: llvm/include/llvm/Debuginfod/HTTPServer.h:89

Method Overview

  • public HTTPServer()
  • public llvm::Error bind(unsigned int Port, const char * HostInterface = "0.0.0.0")
  • public Expected<unsigned int> bind(const char * HostInterface = "0.0.0.0")
  • public llvm::Error get(llvm::StringRef UrlPathPattern, llvm::HTTPRequestHandler Handler)
  • public static bool isAvailable()
  • public llvm::Error listen()
  • public void stop()
  • public ~HTTPServer()

Methods

HTTPServer()

Declared at: llvm/include/llvm/Debuginfod/HTTPServer.h:95

llvm::Error bind(
    unsigned int Port,
    const char* HostInterface = "0.0.0.0")

Description

Attempts to assign the requested port and interface, returning an Error upon failure.

Declared at: llvm/include/llvm/Debuginfod/HTTPServer.h:108

Parameters

unsigned int Port
const char* HostInterface = "0.0.0.0"

Expected<unsigned int> bind(
    const char* HostInterface = "0.0.0.0")

Description

Attempts to assign any available port and interface, returning either the port number or an Error upon failure.

Declared at: llvm/include/llvm/Debuginfod/HTTPServer.h:112

Parameters

const char* HostInterface = "0.0.0.0"

llvm::Error get(llvm::StringRef UrlPathPattern,
                llvm::HTTPRequestHandler Handler)

Description

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.

Declared at: llvm/include/llvm/Debuginfod/HTTPServer.h:104

Parameters

llvm::StringRef UrlPathPattern
llvm::HTTPRequestHandler Handler

static bool isAvailable()

Description

Returns true only if LLVM has been compiled with a working HTTPServer.

Declared at: llvm/include/llvm/Debuginfod/HTTPServer.h:99

llvm::Error listen()

Description

Attempts to listen for requests on the bound port. Returns an Error if called before binding a port.

Declared at: llvm/include/llvm/Debuginfod/HTTPServer.h:116

void stop()

Description

If the server is listening, stop and unbind the socket.

Declared at: llvm/include/llvm/Debuginfod/HTTPServer.h:119

~HTTPServer()

Declared at: llvm/include/llvm/Debuginfod/HTTPServer.h:96