mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-08-21 17:45:02 +00:00
Merge the SSLClient and WebSocketClient TLS session setup
SSLClient::initialize_ssl kept its own copy of the session setup that detail::setup_client_tls_session already implemented for WebSocketClient. Extend the shared function with the pieces only SSLClient needed - a session verifier, an independent hostname verification flag, the context mutex, Windows Schannel verification and error details - and let initialize_ssl build a ClientTlsSessionOptions and call it. All of them default, so WebSocketClient's call site is unchanged. This settles one difference between the two: WebSocketClient used to call tls::set_hostname for named hosts, which on OpenSSL turns on verification during the handshake, while SSLClient always set SNI only and verified post-handshake. The shared function now does the latter for both, so tls::set_hostname loses its last caller and goes away, as does the write-only SSLClient::verify_result_. Certificate verification with a host name rather than an IP literal was the one combination the WebSocket tests never covered, and it is exactly the path this normalizes. WebSocketSSLDnsHostTest fills that in; cert2 gains a DNS:localhost SAN so a name can be verified against it.
This commit is contained in:
@@ -18,4 +18,4 @@ emailAddress = test@email.address
|
||||
challengePassword = 1234
|
||||
|
||||
[SAN]
|
||||
subjectAltName=IP:127.0.0.1
|
||||
subjectAltName=IP:127.0.0.1,DNS:localhost
|
||||
|
||||
Reference in New Issue
Block a user