[issue16298] httplib.HTTPResponse.read could potentially leave the socket opened forever

2012-12-15 Thread Eran Rundstein
Eran Rundstein added the comment: My pleasure. I had no idea about the Mercurial patch, this is the first time I have submitted a Python bug report :) I'll have a look. Thanks for merging the fix! -- ___ Python tracker

[issue16298] httplib.HTTPResponse.read could potentially leave the socket opened forever

2012-12-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ok, the patch looked fine to me, so I've committed it to 2.7 and adapted it for 3.x. Thank you! By the way, it's probably easier to produce patches using Mercurial rather than using manual `diff`. You can have a look at the devguide for more information: http:

[issue16298] httplib.HTTPResponse.read could potentially leave the socket opened forever

2012-12-15 Thread Roundup Robot
Roundup Robot added the comment: New changeset 2186f7b99c28 by Antoine Pitrou in branch '2.7': Issue #16298: In HTTPResponse.read(), close the socket when there is no Content-Length and the incoming stream is finished. http://hg.python.org/cpython/rev/2186f7b99c28 New changeset b47d342c449b by

[issue16298] httplib.HTTPResponse.read could potentially leave the socket opened forever

2012-12-15 Thread Eran Rundstein
Eran Rundstein added the comment: Hm, it's been a while and I'm no longer sure :( You're right - since there is no length the user will have to call read() until he gets back ''. It's possible I forgot that assumption when speculating about this. -- ___

[issue16298] httplib.HTTPResponse.read could potentially leave the socket opened forever

2012-12-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: Sorry for the delay. I am not sure I understand your concern here: > If the user reads the exact amount of bytes the server sent, read() on > the > socket will never have a chance to return '' and inform the user > about the connection termination. Certainly r

[issue16298] httplib.HTTPResponse.read could potentially leave the socket opened forever

2012-11-13 Thread Shivaram Lingamneni
Changes by Shivaram Lingamneni : -- nosy: +slingamn ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail

[issue16298] httplib.HTTPResponse.read could potentially leave the socket opened forever

2012-11-06 Thread Eran Rundstein
Eran Rundstein added the comment: Hello I have attached a patch that includes a (slightly broken) fix and a test case. Note that there is currently an unresolved issue: If the user reads the exact amount of bytes the server sent, read() on the socket will never have a chance to return '' and i

[issue16298] httplib.HTTPResponse.read could potentially leave the socket opened forever

2012-11-04 Thread Antoine Pitrou
Antoine Pitrou added the comment: > The patch is probably trivial - however I would still like some > verification. > Would it be correct to call self.close() when fp.read returns ''? In > case self.length is not present, I don't see a way around this anyway. > When it is present, and fp.read ret

[issue16298] httplib.HTTPResponse.read could potentially leave the socket opened forever

2012-11-03 Thread Eran Rundstein
Eran Rundstein added the comment: The patch is probably trivial - however I would still like some verification. Would it be correct to call self.close() when fp.read returns ''? In case self.length is not present, I don't see a way around this anyway. When it is present, and fp.read returns '',

[issue16298] httplib.HTTPResponse.read could potentially leave the socket opened forever

2012-10-28 Thread Andrew Svetlov
Andrew Svetlov added the comment: Please publish patch for the issue. -- nosy: +asvetlov ___ Python tracker ___ ___ Python-bugs-list m

[issue16298] httplib.HTTPResponse.read could potentially leave the socket opened forever

2012-10-22 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +orsenthil, pitrou stage: -> needs patch versions: +Python 3.2, Python 3.3, Python 3.4 ___ Python tracker ___ __

[issue16298] httplib.HTTPResponse.read could potentially leave the socket opened forever

2012-10-22 Thread Piotr Dobrogost
Changes by Piotr Dobrogost : -- nosy: +piotr.dobrogost ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://m

[issue16298] httplib.HTTPResponse.read could potentially leave the socket opened forever

2012-10-22 Thread Eran Rundstein
New submission from Eran Rundstein: When calling HTTPResponse.read() on a response that is: a. not chunked b. contains no content-length header the underlying socket (referenced by self.fp) will never get closed (through self.close()) The offending code is at the bottom of the read() function: