[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-04-23 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Hearing no further argument to the contrary, I'm closing this as invalid. -- resolution: - invalid stage: unit test needed - committed/rejected status: open - closed ___ Python tracker

[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-21 Thread Jeremy Hylton
Jeremy Hylton jer...@alum.mit.edu added the comment: On Sat, Feb 20, 2010 at 12:06 AM, R. David Murray rep...@bugs.python.org wrote: R. David Murray rdmur...@bitdance.com added the comment: But the docs (which presumably describe the API) say that the socket is unusable after the call to

[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-21 Thread Jeremy Hylton
Jeremy Hylton jer...@alum.mit.edu added the comment: In particular, I mean this part of the socket API: socket.makefile([mode[, bufsize]]) Return a file object associated with the socket. (File objects are described in File Objects.) The file object references a dup()ped version of the socket

[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-21 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: So do I. I'm saying that paramiko appears to be following the socket API as documented in the python docs (ie: that closing the socket means it is no longer usable). -- ___ Python tracker

[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-21 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: So HTTConnection is closing the thing returned by makefile and that is closing the socket, except that the socket library makes sure it doesn't actually close the socket until the dupped file handle is also closed? I guess I need to

[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-21 Thread Robert Buchholz
Robert Buchholz r...@freitagsrunde.org added the comment: almost... HTTPConnection is calling close() on the socket object, but HTTPResponse still has an open file-like object from a previous makefile() call. That object still has an internal reference to the socket. --

[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-21 Thread Jeremy Hylton
Jeremy Hylton jer...@alum.mit.edu added the comment: On Sun, Feb 21, 2010 at 5:38 PM, Robert Buchholz rep...@bugs.python.org wrote: Robert Buchholz r...@freitagsrunde.org added the comment: almost... HTTPConnection is calling close() on the socket object, but HTTPResponse still has an open

[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-21 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: OK, then I think I understand Jeremy's point now: the paramiko socket is apparently not implementing makefile in a way that matches the documented API. -- ___ Python tracker

Re: [issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-19 Thread Jeremy Hylton
I don't think the HTTPConnection class was designed to work with sockets that don't follow the Python socket API. If you want to use a different socket, you should create some wrapper that emulates the Python socket ref count behavior. Jeremy On Mon, Feb 1, 2010 at 5:23 PM, Robert Buchholz

[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-19 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: But a goal is for the standard library to work with Python implementations other than CPython, and the reference counting behavior described won't happen in non-reference counting implementations. So I don't think that requiring

[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-19 Thread Jeremy Hylton
Jeremy Hylton jer...@alum.mit.edu added the comment: On Fri, Feb 19, 2010 at 6:22 PM, R. David Murray rep...@bugs.python.org wrote: R. David Murray rdmur...@bitdance.com added the comment: But a goal is for the standard library to work with Python implementations other than CPython, and

[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-19 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: But the docs (which presumably describe the API) say that the socket is unusable after the call to close, which argues that the paramiko sockets are following the documented API. Do the docs need to be corrected? --

[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-01 Thread Sijin Joseph
Sijin Joseph sijinjos...@gmail.com added the comment: Looking at the code in httplib it seems that response.will_close is set under the following circumstances, 1. HTTP version is 0.9 2. HTTP response header connection is set to close 3. Non-chunked content with a length of zero This suggests

[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-01 Thread Robert Buchholz
Robert Buchholz r...@freitagsrunde.org added the comment: An example cannot be constructed using the standard python socket class. As you point out, the response.will_close attribute is set correctly: The client is supposed to close to connect after completion of the request (as does the

[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-01-29 Thread Robert Buchholz
New submission from Robert Buchholz r...@freitagsrunde.org: Calling getresponse() on an httplib.HTTPConnection object returns a response object. Internally, the self.sock is handed over to the HTTPResponse object which transforms it into a file-like object. The response object is returned to