From be662f257ad49c8575bf8ce3c82ab16a69698a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= Date: Wed, 16 Jan 2019 11:37:32 +0100 Subject: [PATCH] GH #2549: Fix keepAlive in http client session: left-over _pRequestStream could mess up new request --- Net/src/HTTPClientSession.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Net/src/HTTPClientSession.cpp b/Net/src/HTTPClientSession.cpp index 49b8d58d6..59c7535eb 100644 --- a/Net/src/HTTPClientSession.cpp +++ b/Net/src/HTTPClientSession.cpp @@ -165,7 +165,7 @@ void HTTPClientSession::setProxyUsername(const std::string& username) { _proxyConfig.username = username; } - + void HTTPClientSession::setProxyPassword(const std::string& password) { @@ -193,8 +193,9 @@ void HTTPClientSession::setKeepAliveTimeout(const Poco::Timespan& timeout) std::ostream& HTTPClientSession::sendRequest(HTTPRequest& request) { - clearException(); + _pRequestStream = 0; _pResponseStream = 0; + clearException(); _responseReceived = false; bool keepAlive = getKeepAlive(); @@ -247,7 +248,7 @@ std::ostream& HTTPClientSession::sendRequest(HTTPRequest& request) { _pRequestStream = new HTTPOutputStream(*this); request.write(*_pRequestStream); - } + } _lastRequest.update(); return *_pRequestStream; } @@ -301,7 +302,7 @@ std::istream& HTTPClientSession::receiveResponse(HTTPResponse& response) #endif else _pResponseStream = new HTTPInputStream(*this); - + return *_pResponseStream; }