mirror of
https://github.com/pocoproject/poco.git
synced 2025-03-04 07:27:23 +01:00
fixed GH #2570: DialogSocket: receiveStatusMessage() - line length limit applies to entire multi-line message
This commit is contained in:
parent
03ced50f88
commit
479564069e
@ -31,7 +31,7 @@ DialogSocket::DialogSocket():
|
||||
}
|
||||
|
||||
|
||||
DialogSocket::DialogSocket(const SocketAddress& address):
|
||||
DialogSocket::DialogSocket(const SocketAddress& address):
|
||||
StreamSocket(address),
|
||||
_pBuffer(0),
|
||||
_pNext(0),
|
||||
@ -41,7 +41,7 @@ DialogSocket::DialogSocket(const SocketAddress& address):
|
||||
}
|
||||
|
||||
|
||||
DialogSocket::DialogSocket(const Socket& socket):
|
||||
DialogSocket::DialogSocket(const Socket& socket):
|
||||
StreamSocket(socket),
|
||||
_pBuffer(0),
|
||||
_pNext(0),
|
||||
@ -161,7 +161,7 @@ int DialogSocket::receiveStatusMessage(std::string& message)
|
||||
while (status <= 0)
|
||||
{
|
||||
message += '\n';
|
||||
status = receiveStatusLine(message, MAX_LINE_LENGTH);
|
||||
status = receiveStatusLine(message, message.length() + MAX_LINE_LENGTH);
|
||||
}
|
||||
}
|
||||
return status;
|
||||
|
@ -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;
|
||||
}
|
||||
@ -259,11 +260,16 @@ std::ostream& HTTPClientSession::sendRequest(HTTPRequest& request)
|
||||
}
|
||||
|
||||
|
||||
std::istream& HTTPClientSession::receiveResponse(HTTPResponse& response)
|
||||
void HTTPClientSession::flushRequest()
|
||||
{
|
||||
_pRequestStream = 0;
|
||||
if (networkException()) networkException()->rethrow();
|
||||
}
|
||||
|
||||
|
||||
std::istream& HTTPClientSession::receiveResponse(HTTPResponse& response)
|
||||
{
|
||||
flushRequest();
|
||||
if (!_responseReceived)
|
||||
{
|
||||
do
|
||||
@ -301,7 +307,7 @@ std::istream& HTTPClientSession::receiveResponse(HTTPResponse& response)
|
||||
#endif
|
||||
else
|
||||
_pResponseStream = new HTTPInputStream(*this);
|
||||
|
||||
|
||||
return *_pResponseStream;
|
||||
}
|
||||
|
||||
@ -354,13 +360,14 @@ int HTTPClientSession::write(const char* buffer, std::streamsize length)
|
||||
_reconnect = false;
|
||||
return rc;
|
||||
}
|
||||
catch (NetException&)
|
||||
catch (IOException&)
|
||||
{
|
||||
if (_reconnect)
|
||||
{
|
||||
close();
|
||||
reconnect();
|
||||
int rc = HTTPSession::write(buffer, length);
|
||||
clearException();
|
||||
_reconnect = false;
|
||||
return rc;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user