mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-08-22 10:02:00 +00:00
Give WebSocketClient the PemMemory client certificate constructor SSLClient has
Adds ws::WebSocketClient::PemMemory and a constructor overload that installs an in-memory client certificate on the TLS context, enabling mutual TLS for wss:// connections. The certificate is silently ignored for ws:// URLs, consistent with the existing TLS-only setters such as set_ca_cert_path(). Part of the interface alignment discussed in #2531.
This commit is contained in:
@@ -135,6 +135,19 @@ bool is_open() const;
|
||||
explicit WebSocketClient(const std::string &scheme_host_port_path,
|
||||
const Headers &headers = {});
|
||||
|
||||
// Constructor with a client certificate for mutual TLS (wss:// only,
|
||||
// requires CPPHTTPLIB_OPENSSL_SUPPORT). The certificate is ignored for
|
||||
// ws:// URLs.
|
||||
struct PemMemory {
|
||||
const char *cert_pem;
|
||||
size_t cert_pem_len;
|
||||
const char *key_pem;
|
||||
size_t key_pem_len;
|
||||
const char *private_key_password;
|
||||
};
|
||||
explicit WebSocketClient(const std::string &scheme_host_port_path,
|
||||
const PemMemory &pem, const Headers &headers = {});
|
||||
|
||||
// Check if the URL was parsed successfully
|
||||
bool is_valid() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user