diff --git a/Net/include/Poco/Net/HTTPClientSession.h b/Net/include/Poco/Net/HTTPClientSession.h index 714b24d69..5d21716a4 100644 --- a/Net/include/Poco/Net/HTTPClientSession.h +++ b/Net/include/Poco/Net/HTTPClientSession.h @@ -100,6 +100,9 @@ public: HTTPClientSession(const std::string& host, Poco::UInt16 port, const ProxyConfig& proxyConfig); /// Creates a HTTPClientSession using the given host, port and proxy configuration. + + HTTPClientSession(const StreamSocket& socket, const ProxyConfig& proxyConfig); + /// Creates a HTTPClientSession using the given socket and proxy configuration. virtual ~HTTPClientSession(); /// Destroys the HTTPClientSession and closes diff --git a/Net/src/HTTPClientSession.cpp b/Net/src/HTTPClientSession.cpp index 336a6b617..9dc357967 100644 --- a/Net/src/HTTPClientSession.cpp +++ b/Net/src/HTTPClientSession.cpp @@ -58,8 +58,9 @@ HTTPClientSession::HTTPClientSession(const StreamSocket& socket): _reconnect(false), _mustReconnect(false), _expectResponseBody(false), - _responseReceived(false) + _responseReceived(false) { + setKeepAlive(true); } @@ -101,7 +102,19 @@ HTTPClientSession::HTTPClientSession(const std::string& host, Poco::UInt16 port, { } - +HTTPClientSession::HTTPClientSession(const StreamSocket& socket, const ProxyConfig& proxyConfig): + HTTPSession(socket), + _port(HTTPSession::HTTP_PORT), + _proxyConfig(proxyConfig), + _keepAliveTimeout(DEFAULT_KEEP_ALIVE_TIMEOUT, 0), + _reconnect(false), + _mustReconnect(false), + _expectResponseBody(false), + _responseReceived(false) +{ + setKeepAlive(true); +} + HTTPClientSession::~HTTPClientSession() { }