HTTPServer Documentation¶
A small, single-binary HTTP server library and example application written in modern C++. It provides a minimal HTTP request parser, routing, static-file handling, and helpers for building both HTTP and HTTPS servers.
This documentation site is generated with Sphinx + Breathe using Doxygen XML output for the C++ API.
Quick Start¶
This project uses CMake and provides a Makefile for common developer tasks:
make build # configure and build in ./build
make run # build then run the example server
make test # build and run all tests
make clean # remove build directory
make format # format the source code
make docs # build the documentation
Further Reading¶
Installation - How to install the library to your system.
Usage Guide - Learn how to build applications using the library.
Configuration Reference - Detailed reference for server settings.
Architecture - Deep dive into the server’s internal design.
Metrics Monitoring - Monitor server performance and usage.
Testing - Information about the project’s testing strategy.
Contents:
- API Reference
- Project Structure
- Key Components
- Detailed API
- Config
HTTPServerHTTPServer::ConfigHTTPServer::ServerConfigkPortkRedirectionPortkEnableHttpskCertFilekKeyFilekEnableHttpRedirectionkCleanupIntervalkIdleTimeoutkClientTimeoutSeckMaxRequestDurationSeckRecvBufferSizekMinThreadskMaxThreadskMaxQueueSizekMaxConnectionsPerIpkMaxKeepAliveRequestskMaxTokenskRefillRatekMaxHeaderByteskMaxHeaderCountkMaxTotalHeaderSizekMaxBodyByteskAllowedMethodskAllowedVersionskLogLevelkFileLoggingEnabledkFileLoggingPath
- Connection Guard
- Connection Handler
- Connection Manager
- Event Dispatcher
- Events
- Http Object
- Http Parser
HTTPServerParseStateBodyTypeChunkStateParseResultParseErrorNONEINVALID_REQUEST_LINE_FORMATREQUEST_METHOD_EMPTYREQUEST_METHOD_LOWERCASEUNSUPPORTED_METHODUNSUPPORTED_VERSIONINVALID_HEADER_MISSING_COLONINVALID_HEADER_UNSUPPORTED_CHARACTERHEADER_TOO_LARGEMISSING_HOST_HEADERCONTENT_LENGTH_EMPTYCONTENT_LENGTH_NOT_NUMERICBODY_TOO_LARGEINVALID_CHUNKED_ENCODINGTOO_MANY_HEADERSTOTAL_HEADER_SIZE_TOO_LARGE
HTTPServer::HttpParserHttpParser()parse()hasCompleteRequest()takeRequest()hasError()error()reset()parseRequestLine()parseHeaders()determineBodyFraming()parseBody()parseChunkSize()parseChunkData()parseChunkTrailers()consumeLine()validateRequestLine()validateHeaders()parseQueryParams()urlDecode()d_stated_bodyTyped_chunkStated_errord_requestd_lineBufferd_bodyBytesRemainingd_currentChunkSized_currentChunkReadd_currentHeaderCountd_currentTotalHeaderSize
- Http Response Builder
- Httpserver
- Log Event
- Log Level
- Log Stream
- Logger
- Metrics
HTTPServerHTTPServer::MetricsonEvent()incrementActiveConnection()decrementActiveConnection()incrementTotalRequests()recordResponseStatus()recordBytesReceived()recordBytesSent()recordRequestProcessingTime()snapshot()instance()Metrics()~Metrics()Metrics()operator=()Metrics()operator=()d_activeConnectionsd_totalRequestsd_responses2xxd_responses3xxd_responses4xxd_responses5xxd_totalBytesReceivedd_totalBytesSentd_totalRequestProcessingTimeMs
HTTPServer::MetricsSnapshot
- Periodic Idle Ip Cleanup
- Port
- Route Matchers
- Router
- Server
HTTPServerHTTPServer::ServerServer()Server()Server()operator=()port()start()installSignalHandlers()stop()UniqueSSL_CTXaccept_loop()init_ssl_context()cleanup_ssl_context()dispatch_client()handle_client()handle_client()start_http_redirect()server_fdredirection_server_fdd_runningd_thread_poolssl_ctxd_periodic_idle_ip_cleanup
- Thread Pool
- Unique Fd
- Utils
- Config
- Usage Guide
- Configuration Reference
- Architecture
- Metrics Monitoring
- Testing
- Installation