mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-20 22:31:23 +01:00
#3147: Reading from request stream hangs when "Transfer-Encoding: chunked" is used
This commit is contained in:
parent
aa48d39dbd
commit
99936745e4
@ -81,9 +81,14 @@ int HTTPChunkedStreamBuf::readFromDevice(char* buffer, std::streamsize length)
|
||||
while (ch != eof && ch != '\n') ch = _session.get();
|
||||
unsigned chunk;
|
||||
if (NumberParser::tryParseHex(chunkLen, chunk))
|
||||
{
|
||||
_chunk = (std::streamsize) chunk;
|
||||
}
|
||||
else
|
||||
{
|
||||
_chunk = -1;
|
||||
return eof;
|
||||
}
|
||||
}
|
||||
if (_chunk > 0)
|
||||
{
|
||||
@ -92,7 +97,7 @@ int HTTPChunkedStreamBuf::readFromDevice(char* buffer, std::streamsize length)
|
||||
if (n > 0) _chunk -= n;
|
||||
return n;
|
||||
}
|
||||
else
|
||||
else if (_chunk == 0)
|
||||
{
|
||||
int ch = _session.peek();
|
||||
if (ch != eof && ch != '\r' && ch != '\n')
|
||||
@ -113,8 +118,10 @@ int HTTPChunkedStreamBuf::readFromDevice(char* buffer, std::streamsize length)
|
||||
ch = _session.get();
|
||||
while (ch != eof && ch != '\n') ch = _session.get();
|
||||
}
|
||||
_chunk = -1;
|
||||
return 0;
|
||||
}
|
||||
else return eof;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user