mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-18 19:48:44 +02:00
added support for global HTTP proxy configuration
This commit is contained in:
@@ -89,11 +89,23 @@ std::istream* HTTPSStreamFactory::open(const URI& uri)
|
||||
pSession = new HTTPSClientSession(resolvedURI.getHost(), resolvedURI.getPort());
|
||||
else
|
||||
pSession = new HTTPClientSession(resolvedURI.getHost(), resolvedURI.getPort());
|
||||
|
||||
if (proxyUri.empty())
|
||||
pSession->setProxy(_proxyHost, _proxyPort);
|
||||
{
|
||||
if (!_proxyHost.empty())
|
||||
{
|
||||
pSession->setProxy(_proxyHost, _proxyPort);
|
||||
pSession->setProxyCredentials(_proxyUsername, _proxyPassword);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pSession->setProxy(proxyUri.getHost(), proxyUri.getPort());
|
||||
pSession->setProxyCredentials(_proxyUsername, _proxyPassword);
|
||||
if (!_proxyUsername.empty())
|
||||
{
|
||||
pSession->setProxyCredentials(_proxyUsername, _proxyPassword);
|
||||
}
|
||||
}
|
||||
}
|
||||
std::string path = resolvedURI.getPathAndQuery();
|
||||
if (path.empty()) path = "/";
|
||||
@@ -136,7 +148,8 @@ std::istream* HTTPSStreamFactory::open(const URI& uri)
|
||||
// single request via the proxy. 305 responses MUST only be generated by origin servers.
|
||||
// only use for one single request!
|
||||
proxyUri.resolve(res.get("Location"));
|
||||
delete pSession; pSession = 0;
|
||||
delete pSession;
|
||||
pSession = 0;
|
||||
retry = true; // only allow useproxy once
|
||||
}
|
||||
else if (res.getStatus() == HTTPResponse::HTTP_UNAUTHORIZED && !authorize)
|
||||
|
Reference in New Issue
Block a user