GeezerVison is showing cpp.libhunt.com โ cpp-httplib/CHANGELOG and cpp-httplib Releases | LibHunt
A C++ header-only HTTP/HTTPS server and client library
Latest Release
139 days ago
-
July 12, 2026
What's Changed
๐ Security fixes
- Fix use-after-free of TLS session in
WebSocketClient::shutdown_and_close() (GHSA-w7p7-f35j-mw7q). shutdown_and_close() freed the TLS session before ws_->close() sent the WebSocket close frame. The WebSocket's SSLSocketStream keeps a raw pointer to that session, so sending the close frame read/wrote a freed SSL object. This affects any wss:// client that is destroyed (or reconnected via connect()) while the connection is still open, without an explicit close() first. The close frame is now sent while the session is still alive, and the session is freed afterward. Regression tests covering both the destroy-while-open and reconnect-while-open paths were added
Full Changelog : v0.50.0...v0.50.1
-
July 11, 2026
What's Changed
๐ Security fixes
- Fix CRLF injection in chunked response trailers. Trailer field names and values written via
DataSink::done_with_trailer() were never validated, unlike every other header output path (set_header, WebSocket handshake, client request headers). An application reflecting untrusted input into a trailer could inject CR/LF sequences and achieve HTTP response splitting. Trailer fields with invalid names or values are now silently skipped, matching set_header()'s existing behavior
๐ฅ Breaking changes
- โ Add
Get(path, params, progress) overload to ClientImpl/Client (#2486). This makes calls that pass a headers argument as a braced initializer list โ e.g. cli.Get(path, {{"Accept", "..."}}) โ ambiguous between the existing Get(path, headers) overload and the new Get(path, params) overload, since {{...}} can construct either Headers or Params. Existing code relying on that implicit conversion will fail to compile with an "ambiguous call" error; disambiguate by wrapping the argument explicitly, e.g. cli.Get(path, Headers{{"Accept", "..."}}). All in-tree call sites (test.cc, test_proxy.cc, README) were updated to do this
๐ Bug fixes
- Fix use-after-free in
SSLClient destructor with mbedTLS (Fix #2492). SSLClient::~SSLClient() freed the TLS context before shutting down the SSL session. mbedTLS sessions hold a raw pointer into the context's mbedtls_ssl_config, so a live keep-alive session's close_notify could read freed memory. The session is now shut down before the context is freed
- Fix
Response::content_length_ not reflecting body size in Logger (Fix #2488). Server::apply_ranges computed the correct Content-Length header for body-based responses but never updated content_length_, so the Logger callback always saw 0. It now reflects the final body size (post-range/post-compression)
๐ Docs
- ๐ Fix README WebSocket example to match actual API (Fix #2493). The quick preview referenced a nonexistent
httplib::ws::Message type with .is_text()/.data; the actual API uses a plain std::string with ws.read(msg), as already shown in README-websocket.md
- ๐ Fix broken relative links in cookbook docs (Fix #2490). Cookbook body links referenced sibling pages with a bare slug (e.g.
c14-keep-alive), which 404 under the pretty-URL layout since each page lives in its own directory. Links are now prefixed with ../ to match convention
Full Changelog : v0.49.0...v0.50.0
-
July 02, 2026
What's Changed
๐ Security fixes
- ๐ป Escape
", CR, and LF in multipart field names and filenames when serializing multipart/form-data bodies. Previously these values were concatenated into the Content-Disposition quoted-string unescaped, so a " silently terminated the quoted-string early, and embedded CR/LF allowed injecting arbitrary part headers or forging part boundaries when a filename comes from external input. Escaping follows the WHATWG HTML standard (" โ %22, CR โ %0D, LF โ %0A), matching what browsers send; behavior only changes for inputs that previously produced malformed HTTP
- Close the same header-injection vector for part content types: CR/LF in
MultipartFormData::content_type are now escaped (%0D/%0A) before being written into the part's Content-Type header. " is left intact since it is legal in Content-Type values (e.g. quoted charset parameters)
๐ New features
- Add public
MultipartFormDataWriter for multipart body serialization outside Client::Post/Put/Patch (e.g. to feed a custom content provider or compose with other body sources), which previously required calling unstable detail:: functions directly. Supports whole-body serialization with known content length and per-part framing (item_begin/item_end/finish) for streaming. Also exposes is_valid_multipart_boundary() so callers using an explicit boundary can validate it without exceptions
- Make the
ThreadPool idle timeout for dynamic threads configurable at runtime via a new fourth constructor parameter: ThreadPool(base_threads, max_threads, max_queued_requests, idle_timeout_sec) (Fix #2481)
๐ Bug fixes
- Classify ASCII bytes without consulting the global C locale.
std::isalnum/std::isdigit read the locale, so a byte like 0xC5 could classify as alphanumeric once an embedder called setlocale() (observed on macOS). New detail::is_ascii_digit/is_ascii_alpha/is_ascii_alnum helpers are now used at every classification site โ multipart boundary validation, token checks, URI encoding, range header parsing, and IPv4 host detection โ and the <cctype> include is dropped (Fix #2482, Fix #2483)
- 0๏ธโฃ Omit the default port from the WebSocket handshake
Host header, per RFC 6455 Section 4.1 (include the port only when it is not 80 for ws / 443 for wss). Some CDNs alter routing when the Host header carries an explicit default port. IPv6 literal hosts are now bracketed correctly as well (Fix #2480)
- Send the query string verbatim when path encoding is disabled.
set_path_encode(false) only suppressed encoding of the path; the query was still decoded and re-encoded, which is lossy for pre-encoded payloads (%2C โ ,, %20 โ +, etc.) and could corrupt binary query data on strict RFC 3986 servers (#2479)
- ๐ Use an unsigned accumulator in
base64_encode to avoid implementation-defined behavior with high-bit input bytes (#2477)
๐ Build
- ๐ meson: fix build failure on glibc >= 2.34, where
getaddrinfo_a is built into libc and no standalone libanl exists (also fixes architectures like loongarch64/riscv64 that never shipped one) (#2484)
Full Changelog : v0.48.0...v0.49.0
-
June 19, 2026
What's Changed
๐ Security fixes
- Complete the IP-host certificate identity fix from v0.47.0 for the Mbed TLS and wolfSSL backends. An IP-literal host is now authenticated only via a matching
iPAddress SAN, never via the certificate's Common Name (RFC 9110) โ matching what the OpenSSL backend already enforces through X509_check_ip. Previously these backends fell back to the CN when no IP SAN matched, and recognized IPv4 only; now IPv6 (16-byte) iPAddress SANs are matched as well, and the CN fallback is skipped for both IPv4 and IPv6 literal hosts (#2476)
๐ Improvements
- ๐ Replace the
strtod-based from_chars for double with a hand-written, locale-independent parser. The only double parsed by the library is the HTTP quality value; strtod reads the decimal separator from the global C locale, so an embedder calling setlocale(LC_ALL, "") into a comma-decimal locale would mis-parse q-values. The new parser always treats . as the decimal separator and is allocation-free (Fix #2475)
- Fix OpenSSL 4.0 deprecation warnings: fetch CA store objects via the thread-safe
X509_STORE_get1_objects() (OpenSSL 3.3+) and extract the subject CN via X509_NAME_get_index_by_NID()/X509_NAME_get_entry() instead of the deprecated X509_STORE_get0_objects() and X509_NAME_get_text_by_NID(). Older OpenSSL, BoringSSL, and LibreSSL keep using the get0 path. Verified warning-free against OpenSSL 4.0.1, 3.6.2, and 3.0
Behavior changes
decode_query_component() now uses strict hex parsing for percent-escapes, consistent with decode_uri_component() and decode_path_component(). A % followed by non-hex characters (e.g. a sign or whitespace such as %-1, %+5, % 5) is passed through literally instead of being accepted as a valid escape (#2472)
Internal
- ๐ OSS-Fuzz: add new fuzzer targets for multipart parsing (#2473)
Full Changelog : v0.47.0...v0.48.0
-
June 10, 2026
What's Changed
๐ Security fixes
- ๐ Fix TLS certificate chain verification bypass for IP-literal hosts on the Mbed TLS and wolfSSL backends: with server certificate verification enabled,
SSLClient skipped chain validation entirely (any untrusted certificate with a matching IP SAN was accepted), and WebSocketClient on Mbed TLS skipped verification altogether. Chain verification now stays enabled for IP hosts, and certificate identity is verified post-handshake against IP SANs on all backends. SNI is no longer sent for IP hosts on Mbed TLS and wolfSSL, per RFC 6066
๐ New features
- Add
Server::set_start_handler(): a callback invoked when the server is ready to accept connections, useful when running the server in a background thread (#2467)
- Add
Client/SSLClient/WebSocketClient::enable_system_ca(bool) to opt into loading system CA certificates alongside a custom CA. The default is unchanged: a custom CA remains exclusive. The setting carries over to clients created for HTTPS redirects (#2471)
- Add
WebSocketClient::set_hostname_addr_map() to connect to a specific IP address while keeping the original hostname for the handshake and certificate verification (#2463)
Behavior changes
- ๐ The request body is now read after route matching and the pre-request handler, so both the regular handler and
ContentReader paths behave the same: route matching โ pre-request handler โ body read โ handler. A request rejected by the pre-request handler (e.g. failed per-route authentication via req.matched_route) no longer buffers the body at all. Note: code that referenced req.body or body-derived form fields inside the pre-request handler will now see an empty body; inspect headers, path, query parameters, or matched_route instead
WebSocketClient with a custom CA no longer merges system CA certificates (it previously always merged them). This matches SSLClient behavior; call enable_system_ca(true) to load system CA certificates alongside the custom CA
Range request headers are now ignored for streaming responses of unknown length instead of producing an invalid response (#2465)
๐ Bug fixes
- Fix
SSLClient::set_ca_cert_store() breaking custom-CA exclusivity: system CA certificates were silently merged into the user-provided store, broadening the trust set. Also fix Client::load_ca_cert_store() not carrying CA certificates over to clients created for HTTPS redirects
- ๐ Fix
WebSocketClient dropping the query string from the URL during the upgrade handshake, so query parameters (e.g. auth tokens) are sent (#2468)
- Fix a use-after-free when reconnecting a
WebSocketClient after set_ca_cert_store(), and a memory leak in the Mbed TLS and wolfSSL set_ca_cert_store() backends
- ๐ Fix MSVC warning C4309 (truncation of constant value) in SHA padding code (#2464)
- Cast to
unsigned char before ctype calls in is_hex and is_token_char to avoid undefined behavior with negative char values (#2469)
Full Changelog : v0.46.1...v0.47.0
-
June 01, 2026
What's Changed
๐ Bug fixes
- ๐ Fix
Expect: 100-continue over TLS: the client decided whether to withhold the request body based on raw socket readability, but post-handshake TLS 1.3 records (e.g. session tickets) make the socket readable without any HTTP response, causing the body to be withheld and the request to fail with Failed to read connection. The client now decides by attempting to read the status line within the 100-continue timeout, and sends the body if none arrives (matching curl) (#2458, #2460)
- ๐ Fix
-Wmissing-field-initializers warnings on Windows by using {} instead of {0} for OVERLAPPED and ADDRINFOEXW initialization (#2459)
-
May 25, 2026
What's Changed
๐ Security
- ๐ Fix proxy digest credential leak when an HTTPS origin returns
407 inside a CONNECT tunnel. The 401/407 retry is now gated on the response actually coming from a proxy hop (#2457)
๐ New features
- Add
Client::set_no_proxy() for per-host proxy bypass. Accepts *, hostname suffix (dot-boundary rule), IPv4/IPv6 CIDR, and bare IP literals. Proxy-Authorization is suppressed for bypassed hosts, including across redirects (#2446, #2448)
-
May 25, 2026
What's Changed
๐ Bug fixes
- Fix iOS build break caused by
TARGET_OS_MAC being true on all Apple platforms (iOS, tvOS, watchOS). The Keychain enumeration path and Security.h include guards are now narrowed to TARGET_OS_OSX, and defining CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN on a non-macOS Apple platform now emits an explicit #error directing users to set_ca_cert_path() with a bundled CA file. Addresses #2454 (#2455)
- ๐ Fix zstd detection in the installed
httplibConfig.cmake so downstream projects that depend on the installed package correctly pick up zstd (#2453)
๐ Improvements
- ๐ Replace the deprecated
SecTrustCopyAnchorCertificates (deprecated in macOS 13) with SecTrustSettingsCopyCertificates, iterating over the System, Admin, and User trust domains to retain equivalent anchor-certificate coverage (#2455)
- Declare
Server::stop() as noexcept, reflecting that the implementation does not throw (#2451)
CI / Internal
- โ Add a best-effort BoringSSL CI job (Ubuntu and macOS) that builds BoringSSL from source and exercises cpp-httplib's existing OpenSSL backend path.
SSLClientServerTest.TlsVerifyHostname is now backend-aware (BoringSSL is SAN-only per RFC 6125 ยง6.4.4), and the README notes BoringSSL as a best-effort variant with the C++14 and SAN-only caveats (#2456)
- Add an iOS header parse check to CI to catch accidental use of macOS-only APIs or guards (e.g.
TARGET_OS_MAC vs TARGET_OS_OSX) that would silently break iOS builds (#2455)
-
May 15, 2026
What's Changed
๐ Bug fixes
- Fix crash on empty / comma-only
X-Forwarded-For when set_trusted_proxies() is configured. get_client_ip() previously called front() on a vector that was empty whenever the header tokenized to zero segments ("", ",", ", , ,"); it now returns an empty string so process_request() falls back to the connection-level remote address instead of crashing (5c92857)
- Fix keep-alive corruption on requests without a framed body (#2450). The post-response drain ran for any request that
expect_content() accepted, so a method like DELETE /items/1 with no Content-Length and no Transfer-Encoding would, on a persistent connection, let read_content consume bytes belonging to the next pipelined request โ making the second request appear to vanish. The drain now only runs when the request actually has a framed body (Content-Length or chunked). The non-SSL "stray-bytes โ 413" payload-limit check is likewise limited to non-persistent connections, since on keep-alive any pending bytes may be the next request rather than an unframed body (91271c0)
Internal
- Extract
detail::has_framed_body() and detail::is_connection_persistent() helpers used by the keep-alive fix above (d755c43)
-
May 10, 2026
What's Changed
๐ฅ Breaking change (behavioral)
- Stop percent-decoding HTTP request header values.
parse_header() previously applied decode_path_component() to every header value (except Location / Referer) after is_field_value() validation, so wire sequences like %0D%0A passed validation and expanded into literal CR/LF inside stored values โ enabling response splitting, log injection, and proxy smuggling. %3D / %2C / %3B likewise flipped Cookie and X-Forwarded-For boundaries against WAFs inspecting the wire form. RFC 9110 ยง5.5 specifies header values as opaque octets, so the auto-decode (and the Location / Referer workarounds for the same misbehavior) has been removed. Applications that need URI semantics on a header value should now call decode_uri_component() or decode_path_component() on the result explicitly. Fixes the long-standing Referer-with-%0A issue (#2033) (fbb031e)
๐ Bug fixes
- Make
ThreadPool constructor exception-safe on partial thread creation. If std::thread construction throws partway through (e.g. pthread_create returns EAGAIN under thread-resource pressure), the partially-built threads_ vector would destruct joinable std::thread objects and call std::terminate(). The spawn loop now signals shutdown to the workers already created, joins them, and rethrows. Fix #2444 (#2445)
Tooling
- ๐
scripts/release.sh gains a --minor flag to force a minor bump even when abidiff reports no ABI break, for behavioral breaking changes like the header-decoding fix above (e8e6528)
|