[issue26499] http.client.IncompleteRead from HTTPResponse read after part reading file

2016-03-16 Thread Martin Panter
Changes by Martin Panter : -- resolution: -> fixed stage: commit review -> resolved status: open -> closed ___ Python tracker ___

[issue26499] http.client.IncompleteRead from HTTPResponse read after part reading file

2016-03-16 Thread Roundup Robot
Roundup Robot added the comment: New changeset e95e9701b472 by Martin Panter in branch '3.5': Issue #26499: Fixes to HTTPResponse.readline() and read1(), by Silent Ghost https://hg.python.org/cpython/rev/e95e9701b472 New changeset 74b3523d6256 by Martin Panter in branch 'default': Issue #26499:

[issue26499] http.client.IncompleteRead from HTTPResponse read after part reading file

2016-03-15 Thread Martin Panter
Martin Panter added the comment: Here is a modified version of the tests that I propose to commit soon. I trimmed the size of the tests down and simplified some of them. I also mentioned that BufferedIOBase is supported in the documentation. -- stage: patch review -> commit review

[issue26499] http.client.IncompleteRead from HTTPResponse read after part reading file

2016-03-13 Thread SilentGhost
SilentGhost added the comment: Updated patch addresses the rietveld comments. -- Added file: http://bugs.python.org/file42155/issue26499_5.diff ___ Python tracker

[issue26499] http.client.IncompleteRead from HTTPResponse read after part reading file

2016-03-12 Thread Martin Panter
Martin Panter added the comment: Thanks Silent Ghost, this patch looks pretty good. I did leave a couple more comments. Also I just realized that HTTPResponse.readline() and read1() are not really documented. The BufferedIOBase support was meant to be added in 3.5, although readline() was

[issue26499] http.client.IncompleteRead from HTTPResponse read after part reading file

2016-03-12 Thread SilentGhost
SilentGhost added the comment: OK, here is the patch including the tests that seem to exercise the behaviour. -- Added file: http://bugs.python.org/file42151/issue26499_4.diff ___ Python tracker

[issue26499] http.client.IncompleteRead from HTTPResponse read after part reading file

2016-03-11 Thread Martin Panter
Martin Panter added the comment: To add a second response you would just concatenate it to the existing response. (Your existing test already uses FakeSocket.) The FakeSocket parameter just represents data that would be sent from the server. So: body = ( b"HTTP/1.1 200 OK\r\n"

[issue26499] http.client.IncompleteRead from HTTPResponse read after part reading file

2016-03-09 Thread SilentGhost
SilentGhost added the comment: All the highlighted issue are now fixed. The limit on n in read1 wasn't tested. Your suggestion regarding testing went a bit over my head, Martin. So, just trying to make sure we're on the same page. ExtendedReadTest, where I thought placing these new tests, is

[issue26499] http.client.IncompleteRead from HTTPResponse read after part reading file

2016-03-09 Thread Martin Panter
Martin Panter added the comment: Yes I agree it would be best to fix the bug(s) without major refactoring if practical. To fix the other bug, I think the parameters in read1(n) and readline(limit) need to be capped at self.length. The inherited BufferedIOBase.readlines() implementation

[issue26499] http.client.IncompleteRead from HTTPResponse read after part reading file

2016-03-09 Thread SilentGhost
SilentGhost added the comment: Here is the updated patch. I only included the additional fix for read1 since readlines is not overwritten in the HTTPConnection. Not sure how to write test for it, does it need a much longer body (compared to the one in tests) to produce this behaviour? The

[issue26499] http.client.IncompleteRead from HTTPResponse read after part reading file

2016-03-08 Thread Martin Panter
Martin Panter added the comment: Thanks for the report and the patch. It looks okay as far as it goes, but I think there are other related bugs: ## read1() doesn’t update length either ## >>> handle = urlopen("https://www.python.org/;) >>> len(handle.read1()) 7374 >>> handle.read() Traceback

[issue26499] http.client.IncompleteRead from HTTPResponse read after part reading file

2016-03-07 Thread SilentGhost
SilentGhost added the comment: As far as I'm able to track it, it was a refactoring in issue 19009 that is responsible for this regression (rev 49017c391564). I'm adding Kristján, so that he'd have a look at the attached fix and test. -- keywords: +3.5regression, patch nosy:

[issue26499] http.client.IncompleteRead from HTTPResponse read after part reading file

2016-03-07 Thread Peter
New submission from Peter: This is a regression in Python 3.5 tested under Linux and Mac OS X, spotted from a failing test in Biopython https://github.com/biopython/biopython/issues/773 where we would parse a file from the internet. The trigger is partially reading the network handle line by