HTTPSessionInstantiator: respect global proxy config

This commit is contained in:
Guenter Obiltschnig 2015-09-17 11:56:28 +02:00
parent 86fe3870e7
commit 89816c0ea2
2 changed files with 10 additions and 4 deletions

View File

@ -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;
}

View File

@ -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;
}