mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 17:30:44 +02:00
Net: near complete merge to 1.4.2
This commit is contained in:
@@ -68,6 +68,15 @@ HTTPStreamFactory::HTTPStreamFactory(const std::string& proxyHost, Poco::UInt16
|
||||
}
|
||||
|
||||
|
||||
HTTPStreamFactory::HTTPStreamFactory(const std::string& proxyHost, Poco::UInt16 proxyPort, const std::string& proxyUsername, const std::string& proxyPassword):
|
||||
_proxyHost(proxyHost),
|
||||
_proxyPort(proxyPort),
|
||||
_proxyUsername(proxyUsername),
|
||||
_proxyPassword(proxyPassword)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
HTTPStreamFactory::~HTTPStreamFactory()
|
||||
{
|
||||
}
|
||||
@@ -92,7 +101,8 @@ std::istream* HTTPStreamFactory::open(const URI& uri)
|
||||
pSession->setProxy(_proxyHost, _proxyPort);
|
||||
else
|
||||
pSession->setProxy(proxyUri.getHost(), proxyUri.getPort());
|
||||
|
||||
pSession->setProxyCredentials(_proxyUsername, _proxyPassword);
|
||||
|
||||
std::string path = resolvedURI.getPathAndQuery();
|
||||
if (path.empty()) path = "/";
|
||||
HTTPRequest req(HTTPRequest::HTTP_GET, path, HTTPMessage::HTTP_1_1);
|
||||
@@ -114,14 +124,14 @@ std::istream* HTTPStreamFactory::open(const URI& uri)
|
||||
}
|
||||
else if (res.getStatus() == HTTPResponse::HTTP_USEPROXY && !retry)
|
||||
{
|
||||
//The requested resource MUST be accessed through the proxy
|
||||
//given by the Location field. The Location field gives the
|
||||
//URI of the proxy. The recipient is expected to repeat this
|
||||
//single request via the proxy. 305 responses MUST only be generated by origin servers.
|
||||
// The requested resource MUST be accessed through the proxy
|
||||
// given by the Location field. The Location field gives the
|
||||
// URI of the proxy. The recipient is expected to repeat this
|
||||
// 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;
|
||||
retry = true; //only allow useproxy once
|
||||
retry = true; // only allow useproxy once
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user