Open illia-v opened 8 months ago
I am not sure that they should raise IncompleteRead
.
AFAIK, only read()
without argument raises IncompleteRead
, because it needs to read the whole content. read1()
and readline()
without argument have different semantic, they do not read to the end of the stream. readline()
reads to the first end of line, and read1()
returns the amount of data depending on buffering. Raising IncompleteRead
with second argument equal to self.length
would be incorrect, because we cannot guarantee that read1()
and readline()
would return the specified number of bytes if the connection was not closed.
Bug report
Bug description:
Unlike
http.client.HTTPResponse.read
,read1
andreadline
do not raiseIncompleteRead
when the content length is know and a connection is closed before everything has been read.FYI, these two methods have had a common issue in the past https://github.com/python/cpython/issues/113199.
CPython versions tested on:
3.8, 3.9, 3.10, 3.11, 3.12, 3.13, CPython main branch
Operating systems tested on:
Linux, macOS, Windows
Linked PRs