Read a NUL-terminated client CA in SSLServer::PemMemory

SSLServer::PemMemory takes a length of 0 to mean a NUL-terminated
string for cert_pem and key_pem, but skipped client_ca_pem when its
length was 0, so a server given its client CA that way started without
requiring client certificates. Read the client CA under the same rule
as the other fields. An empty client CA now fails to load instead of
turning the check off, and the README documents the length-0 rule.
This commit is contained in:
yhirose committed 2026-10-21 16:19:15 -04:00
1 parent 67b88030e8
commit 71b5f0a1c8
3 files changed
+20 -6

No files matched your search

+2
View File
@@ -210,6 +210,8 @@ client_pem.key_pem_len = client_key.size();
httplib::SSLClient cli("api.example.com", 443, client_pem);
```
A length of 0 means the field is a NUL-terminated string.
`httplib::ws::WebSocketClient` has the same `PemMemory` constructor for `wss://` connections. See [README-websocket.md](README-websocket.md) for details.
### Peer Certificate Inspection