diff --git a/src/etp/AbstractClientSessionCRTP.h b/src/etp/AbstractClientSessionCRTP.h index bbdb680..511102f 100644 --- a/src/etp/AbstractClientSessionCRTP.h +++ b/src/etp/AbstractClientSessionCRTP.h @@ -44,7 +44,9 @@ namespace ETP_NS { m.insert(boost::beast::http::field::sec_websocket_protocol, "etp12.energistics.org"); m.insert(boost::beast::http::field::authorization, etpServerAuthorization); - m.insert(boost::beast::http::field::proxy_authorization, proxyAuthorization); + if (!proxyHost.empty() && !isTls()) { + m.insert(boost::beast::http::field::proxy_authorization, proxyAuthorization); + } m.insert("etp-encoding", "binary"); for (const auto& mapEntry : additionalHandshakeHeaderFields_) { m.insert(mapEntry.first, mapEntry.second); @@ -60,7 +62,9 @@ namespace ETP_NS { m.insert(boost::beast::http::field::sec_websocket_protocol, "etp12.energistics.org"); m.insert(boost::beast::http::field::authorization, etpServerAuthorization); - m.insert(boost::beast::http::field::proxy_authorization, proxyAuthorization); + if (!proxyHost.empty() && !isTls()) { + m.insert(boost::beast::http::field::proxy_authorization, proxyAuthorization); + } m.insert("etp-encoding", "binary"); for (const auto& mapEntry : additionalHandshakeHeaderFields_) { m.insert(mapEntry.first, mapEntry.second); diff --git a/src/etp/ClientSession.h b/src/etp/ClientSession.h index 5326ff3..f1fea5a 100644 --- a/src/etp/ClientSession.h +++ b/src/etp/ClientSession.h @@ -70,6 +70,7 @@ namespace ETP_NS } virtual void on_resolve(boost::system::error_code ec, tcp::resolver::results_type results) = 0; + virtual bool isTls() const = 0; void on_handshake(boost::system::error_code ec) { diff --git a/src/etp/PlainClientSession.h b/src/etp/PlainClientSession.h index 24fe5cc..a98b6a8 100644 --- a/src/etp/PlainClientSession.h +++ b/src/etp/PlainClientSession.h @@ -37,6 +37,8 @@ namespace ETP_NS // Called by the base class FETPAPI_DLL_IMPORT_OR_EXPORT websocket::stream& ws() { return ws_; } + bool isTls() const final{ return false; } + void on_resolve(boost::system::error_code ec, tcp::resolver::results_type results) { if (ec) { diff --git a/src/etp/ssl/HttpsClientSession.h b/src/etp/ssl/HttpsClientSession.h index f359c03..067ad1b 100644 --- a/src/etp/ssl/HttpsClientSession.h +++ b/src/etp/ssl/HttpsClientSession.h @@ -92,9 +92,6 @@ namespace ETP_NS if (!authorization.empty()) { req_.set(http::field::authorization, authorization); } - if (!proxyAuthorization.empty()) { - req_.set(http::field::proxy_authorization, proxyAuthorization); - } if (!proxyHost.empty()) { proxyHandshake.version(version); diff --git a/src/etp/ssl/SslClientSession.h b/src/etp/ssl/SslClientSession.h index 5b2d860..5387b8a 100644 --- a/src/etp/ssl/SslClientSession.h +++ b/src/etp/ssl/SslClientSession.h @@ -58,6 +58,8 @@ namespace ETP_NS // Called by the base class FETPAPI_DLL_IMPORT_OR_EXPORT websocket::stream>& ws() { return ws_; } + bool isTls() const final { return true; } + void on_resolve(boost::system::error_code ec, tcp::resolver::results_type results) { if (ec) {