poco icon indicating copy to clipboard operation
poco copied to clipboard

Handle unexpected EOF when reading HTTP streams

Open oandrew opened this issue 5 years ago • 2 comments

Throw an exception on EOF before stream is complete. Stream is complete if: Chunked-Encoding: zero-length chunk received Content-Length: N bytes received

oandrew avatar Apr 19 '20 22:04 oandrew

Hi, @oandrew! Could you please provide the tests so it were easier to understand what bug you solve? There is the other PR concerning the same code: https://github.com/pocoproject/poco/pull/2998 Do you solve the same issue?

Mironenko avatar Nov 20 '20 08:11 Mironenko

Throwing exception from the StreamBufs looks like a rather bold decision. Are you quite sure this does not break the requirement to leave the stream buffer in valid state (see http://www.cplusplus.com/reference/streambuf/basic_streambuf/underflow/ - Exception safety)? What's going to happen if IO stack above will call readFromDevice once more?

Mironenko avatar Nov 20 '20 08:11 Mironenko