From 619950bb2a61f6fc88e5308f96ab4f7b95290f53 Mon Sep 17 00:00:00 2001 From: Guenter Obiltschnig Date: Thu, 17 Sep 2015 11:56:28 +0200 Subject: [PATCH] HTTPSessionInstantiator: respect global proxy config --- Net/src/HTTPSessionInstantiator.cpp | 7 +++++-- NetSSL_OpenSSL/src/HTTPSSessionInstantiator.cpp | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Net/src/HTTPSessionInstantiator.cpp b/Net/src/HTTPSessionInstantiator.cpp index e7c272281..a1136a293 100644 --- a/Net/src/HTTPSessionInstantiator.cpp +++ b/Net/src/HTTPSessionInstantiator.cpp @@ -41,8 +41,11 @@ HTTPClientSession* HTTPSessionInstantiator::createClientSession(const Poco::URI& { poco_assert (uri.getScheme() == "http"); HTTPClientSession* pSession = new HTTPClientSession(uri.getHost(), uri.getPort()); - pSession->setProxy(proxyHost(), proxyPort()); - pSession->setProxyCredentials(proxyUsername(), proxyPassword()); + if (!proxyHost().empty()) + { + pSession->setProxy(proxyHost(), proxyPort()); + pSession->setProxyCredentials(proxyUsername(), proxyPassword()); + } return pSession; } diff --git a/NetSSL_OpenSSL/src/HTTPSSessionInstantiator.cpp b/NetSSL_OpenSSL/src/HTTPSSessionInstantiator.cpp index 4131e4086..f2198eb01 100644 --- a/NetSSL_OpenSSL/src/HTTPSSessionInstantiator.cpp +++ b/NetSSL_OpenSSL/src/HTTPSSessionInstantiator.cpp @@ -43,8 +43,11 @@ HTTPClientSession* HTTPSSessionInstantiator::createClientSession(const Poco::URI { poco_assert (uri.getScheme() == "https"); HTTPSClientSession* pSession = _pContext.isNull() ? new HTTPSClientSession(uri.getHost(), uri.getPort()) : new HTTPSClientSession(uri.getHost(), uri.getPort(), _pContext); - pSession->setProxy(proxyHost(), proxyPort()); - pSession->setProxyCredentials(proxyUsername(), proxyPassword()); + if (!proxyHost().empty()) + { + pSession->setProxy(proxyHost(), proxyPort()); + pSession->setProxyCredentials(proxyUsername(), proxyPassword()); + } return pSession; }