fixed an issue with proxy connect if global proxy config is used

This commit is contained in:
Guenter Obiltschnig 2014-11-13 06:37:33 +01:00
parent eb8dce47fe
commit 28982f9fcc
2 changed files with 19 additions and 3 deletions

View File

@ -1,7 +1,7 @@
//
// HTTPClientSession.h
//
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPClientSession.h#7 $
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPClientSession.h#8 $
//
// Library: Net
// Package: HTTPClient
@ -100,6 +100,9 @@ public:
HTTPClientSession(const std::string& host, Poco::UInt16 port = HTTPSession::HTTP_PORT);
/// Creates a HTTPClientSession using the given host and port.
HTTPClientSession(const std::string& host, Poco::UInt16 port, const ProxyConfig& proxyConfig);
/// Creates a HTTPClientSession using the given host, port and proxy configuration.
virtual ~HTTPClientSession();
/// Destroys the HTTPClientSession and closes
/// the underlying socket.

View File

@ -1,7 +1,7 @@
//
// HTTPClientSession.cpp
//
// $Id: //poco/1.4/Net/src/HTTPClientSession.cpp#14 $
// $Id: //poco/1.4/Net/src/HTTPClientSession.cpp#15 $
//
// Library: Net
// Package: HTTPClient
@ -87,6 +87,18 @@ HTTPClientSession::HTTPClientSession(const std::string& host, Poco::UInt16 port)
}
HTTPClientSession::HTTPClientSession(const std::string& host, Poco::UInt16 port, const ProxyConfig& proxyConfig):
_host(host),
_port(port),
_proxyConfig(proxyConfig),
_keepAliveTimeout(DEFAULT_KEEP_ALIVE_TIMEOUT, 0),
_reconnect(false),
_mustReconnect(false),
_expectResponseBody(false)
{
}
HTTPClientSession::~HTTPClientSession()
{
}
@ -379,7 +391,8 @@ void HTTPClientSession::proxyAuthenticateImpl(HTTPRequest& request)
StreamSocket HTTPClientSession::proxyConnect()
{
HTTPClientSession proxySession(getProxyHost(), getProxyPort());
ProxyConfig emptyProxyConfig;
HTTPClientSession proxySession(getProxyHost(), getProxyPort(), emptyProxyConfig);
proxySession.setTimeout(getTimeout());
std::string targetAddress(_host);
targetAddress.append(":");