Networking

CHTTPServer

Serve files from a document root with configurable request handling.

C++23 mc/CHTTPServer.h
#include <mc/CHTTPServer.h>

Construct from a configuration map. Common keys are root, host, port, runExecutables, readTimeoutSecs, and writeTimeoutSecs.

For a static file server, set runExecutables to false. Set host explicitly when the listener should be restricted to loopback.

Jump to a declaration · 6

CHTTPServer

Methods

CHTTPServer

CHTTPServer(const cvar& args);
CHTTPServer(const CHTTPServer&) = delete;

Copies the server configuration and prepares its resources. Call start() to begin serving and shutdown() to stop; construction alone does not enter the request loop.

start

void start();

Starts serving; binds synchronously so startup failures are reported to the caller.

shutdown

void shutdown();

Stops listening and shuts down request processing.