mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-22 11:46:13 +00:00
Reconnect after a TLS setting changes on a kept-alive client
TLS settings take effect as a connection is set up, so after a client changed one (server certificate or host name verification, a CA store, a verifier) a later request still went over the connection kept alive under the old settings, unverified if verification had just been turned on. Each such setter now bumps a version that the connection records when it is set up, and a connection set up under an older version is closed instead of reused. The setters take no lock, so they cannot wait on a handshake in flight.
This commit is contained in:
1 parent
fc37d3eae1
commit
e121385910
3 files changed
+130
-37
No files matched your search
@@ -102,7 +102,7 @@ cli.enable_server_hostname_verification(false);
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> The CA certificates are loaded when the client makes its first connection. Changing `set_ca_cert_path()` or `enable_system_ca()` after that has no effect, so make the settings before the first request, or use a new client. `set_ca_cert_store()` and `load_ca_cert_store()` take effect at once. `WebSocketClient` works the same way.
|
||||
> The CA certificates are loaded when the client makes its first connection. Changing `set_ca_cert_path()` or `enable_system_ca()` after that has no effect, so make the settings before the first request, or use a new client. `set_ca_cert_store()` and `load_ca_cert_store()` take effect at once. `WebSocketClient` works the same way. On `Client` and `SSLClient`, a setter that changes a TLS setting also closes a connection kept alive under the old one, so the next request connects again.
|
||||
|
||||
### SSL Error Handling
|
||||
|
||||
|
||||
Reference in new issue
Block a user