mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-08-13 13:51:23 +00:00
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.
22 lines
604 B
Plaintext
22 lines
604 B
Plaintext
[req]
|
|
default_bits = 2048
|
|
distinguished_name = req_distinguished_name
|
|
attributes = req_attributes
|
|
prompt = no
|
|
output_password = mypass
|
|
|
|
[req_distinguished_name]
|
|
C = US
|
|
ST = Test State or Province
|
|
L = Test Locality
|
|
O = Organization Name
|
|
OU = Organizational Unit Name
|
|
CN = Common Name
|
|
emailAddress = test@email.address
|
|
|
|
[req_attributes]
|
|
challengePassword = 1234
|
|
|
|
[SAN]
|
|
subjectAltName=IP:127.0.0.1,DNS:localhost
|