Message98695
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. |
|
Date |
User |
Action |
Args |
2010-02-01 22:23:08 | Robert.Buchholz | set | recipients:
+ Robert.Buchholz, sijinjoseph |
2010-02-01 22:23:07 | Robert.Buchholz | set | messageid: <1265062987.89.0.571102322477.issue7806@psf.upfronthosting.co.za> |
2010-02-01 22:23:06 | Robert.Buchholz | link | issue7806 messages |
2010-02-01 22:23:05 | Robert.Buchholz | create | |
|