This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Robert.Buchholz
Recipients Robert.Buchholz, sijinjoseph
Date 2010-02-01.22:23:05
SpamBayes Score 5.749435e-10
Marked as misclassified No
Message-id <1265062987.89.0.571102322477.issue7806@psf.upfronthosting.co.za>
In-reply-to
Content
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 server). However, when the HTTPConnection object calls close() on the socket, reading the request is not completed -- the request object merely created a file-like object representing the socket.

The reason why this is not an issue is that the Python socket library does reference counting to determine when to close a socket object. When the HTTPConnection calls close(), its own socket object is destroyed and unreferenced. However, the file-like object in the HTTPResponse still has a copy of the socket.

In alternative socket implementations (like Paramiko SOCKS-proxied sockets), this poses a problem: When the socket user calls close(), they actually close the socket -- as the original socket API documentation describes:

    close()
    Close the socket.  It cannot be used after this call.

    makefile([mode[, bufsize]]) -> file object
    Return a regular file object corresponding to the socket.  The mode
    and bufsize arguments are as for the built-in open() function.

Consequently, I do not consider this to be a bug in Paramiko and reported it for the httplib. I can present example code using a paramiko tunneled socket (client and server) if you like.
History
Date User Action Args
2010-02-01 22:23:08Robert.Buchholzsetrecipients: + Robert.Buchholz, sijinjoseph
2010-02-01 22:23:07Robert.Buchholzsetmessageid: <1265062987.89.0.571102322477.issue7806@psf.upfronthosting.co.za>
2010-02-01 22:23:06Robert.Buchholzlinkissue7806 messages
2010-02-01 22:23:05Robert.Buchholzcreate