[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

[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 rep...@bugs.python.org http

[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

[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-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