Implementation:SeleniumHQ Selenium Civetweb API
| Knowledge Sources | |
|---|---|
| Domains | C_Plus_Plus, Vendored_Library |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
Vendored C header defining the public API for the CivetWeb embedded HTTP server (version 1.11).
Description
Public C API header for the CivetWeb embedded web server. Defines feature flags (MG_FEATURES_FILES, MG_FEATURES_TLS, MG_FEATURES_CGI, MG_FEATURES_IPV6, MG_FEATURES_WEBSOCKET), server lifecycle functions (mg_init_library, mg_start, mg_stop), request/response handling (mg_write, mg_get_request_info), handler registration (mg_set_request_handler, mg_set_websocket_handler_with_subprotocols, mg_set_auth_handler), and configuration utilities. Supports Windows DLL export/import via CIVETWEB_API macro. Licensed under MIT.
Usage
Included by Selenium's IE WebDriver native C/C++ components and by the C++ wrapper (CivetServer.h).
Code Reference
Source Location
- Repository: SeleniumHQ_Selenium
- File: third_party/cpp/civetweb/civetweb.h
Key API Functions
#define CIVETWEB_VERSION "1.11"
CIVETWEB_API unsigned mg_init_library(unsigned features);
CIVETWEB_API unsigned mg_exit_library(void);
CIVETWEB_API struct mg_context *mg_start(const struct mg_callbacks *callbacks, void *user_data, const char **configuration_options);
CIVETWEB_API void mg_stop(struct mg_context *);
CIVETWEB_API void mg_set_request_handler(struct mg_context *ctx, const char *uri, mg_request_handler handler, void *cbdata);
CIVETWEB_API int mg_write(struct mg_connection *, const void *buf, size_t len);
CIVETWEB_API const struct mg_request_info *mg_get_request_info(const struct mg_connection *);