diff options
author | Roman Grundkiewicz <rgrundkiewicz@gmail.com> | 2022-09-02 16:40:36 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-02 16:40:36 +0300 |
commit | 8909c57b5473cb95e197fa7f034edabb474535ba (patch) | |
tree | e43e942078e441b66f0887c7b8dc4eb3c817e25c /client_wss.hpp | |
parent | 1d7e84aeb3f1ebdc78f6965d79ad3ca3003789fe (diff) | |
parent | db904bbcb73be90b6e52a212660478ceefe5bb9d (diff) |
Update with newest upstream
Diffstat (limited to 'client_wss.hpp')
-rw-r--r-- | client_wss.hpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/client_wss.hpp b/client_wss.hpp index 55ee929..0d19fc9 100644 --- a/client_wss.hpp +++ b/client_wss.hpp @@ -3,7 +3,7 @@ #include "client_ws.hpp" -#ifdef USE_STANDALONE_ASIO +#ifdef ASIO_STANDALONE #include <asio/ssl.hpp> #else #include <boost/asio/ssl.hpp> @@ -27,7 +27,16 @@ namespace SimpleWeb { SocketClient(const std::string &server_port_path, bool verify_certificate = true, const std::string &certification_file = std::string(), const std::string &private_key_file = std::string(), const std::string &verify_file = std::string()) - : SocketClientBase<WSS>::SocketClientBase(server_port_path, 443), context(asio::ssl::context::tlsv12) { + : SocketClientBase<WSS>::SocketClientBase(server_port_path, 443), +#if(ASIO_STANDALONE && ASIO_VERSION >= 101300) || BOOST_ASIO_VERSION >= 101300 + context(asio::ssl::context::tls_client) { + // Disabling TLS 1.0 and 1.1 (see RFC 8996) + context.set_options(asio::ssl::context::no_tlsv1); + context.set_options(asio::ssl::context::no_tlsv1_1); +#else + context(asio::ssl::context::tlsv12) { +#endif + if(certification_file.size() > 0 && private_key_file.size() > 0) { context.use_certificate_chain_file(certification_file); context.use_private_key_file(private_key_file, asio::ssl::context::pem); @@ -87,7 +96,10 @@ namespace SimpleWeb { std::ostream ostream(streambuf.get()); auto host_port = this->host + ':' + std::to_string(this->port); ostream << "CONNECT " + host_port + " HTTP/1.1\r\n" - << "Host: " << host_port << "\r\n\r\n"; + << "Host: " << host_port << "\r\n"; + if(!this->config.proxy_auth.empty()) + ostream << "Proxy-Authorization: Basic " << Crypto::Base64::encode(this->config.proxy_auth) << "\r\n"; + ostream << "\r\n"; connection->set_timeout(this->config.timeout_request); asio::async_write(connection->socket->next_layer(), *streambuf, [this, connection, streambuf](const error_code &ec, std::size_t /*bytes_transferred*/) { connection->cancel_timeout(); |