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,
SSLClientskipped chain validation entirely (any untrusted certificate with a matching IP SAN was accepted), andWebSocketClienton 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
ContentReaderpaths 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 viareq.matched_route) no longer buffers the body at all. Note: code that referencedreq.bodyor body-derived form fields inside the pre-request handler will now see an empty body; inspect headers, path, query parameters, ormatched_routeinstead WebSocketClientwith a custom CA no longer merges system CA certificates (it previously always merged them). This matchesSSLClientbehavior; callenable_system_ca(true)to load system CA certificates alongside the custom CARangerequest 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 fixClient::load_ca_cert_store()not carrying CA certificates over to clients created for HTTPS redirects - Fix
WebSocketClientdropping 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
WebSocketClientafterset_ca_cert_store(), and a memory leak in the Mbed TLS and wolfSSLset_ca_cert_store()backends - Fix MSVC warning C4309 (truncation of constant value) in SHA padding code (#2464)
- Cast to
unsigned charbeforectypecalls inis_hexandis_token_charto avoid undefined behavior with negativecharvalues (#2469)
Full Changelog: v0.46.1...v0.47.0