Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/Simple-WebSocket-Server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'client_wss.hpp')
-rw-r--r--client_wss.hpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/client_wss.hpp b/client_wss.hpp
index f782179..9c5d1e0 100644
--- a/client_wss.hpp
+++ b/client_wss.hpp
@@ -86,15 +86,11 @@ namespace SimpleWeb {
auto streambuf = std::make_shared<asio::streambuf>();
std::ostream ostream(streambuf.get());
auto host_port = this->host + ':' + std::to_string(this->port);
- if(!this->config.proxy_auth.empty()) {
- auto credentials_base64 = std::make_shared<std::string>(Crypto::Base64::encode(this->config.proxy_auth));
- ostream << "CONNECT " + host_port + " HTTP/1.1\r\n"
- << "Proxy-Authorization: Basic " << *credentials_base64 << "\r\n"
- << "Host: " << host_port << "\r\n\r\n";
- } else {
- ostream << "CONNECT " + host_port + " HTTP/1.1\r\n"
- << "Host: " << host_port << "\r\n\r\n";
- }
+ ostream << "CONNECT " + host_port + " HTTP/1.1\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();