Message99599
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 <report@bugs.python.org> wrote:
>
> Robert Buchholz <rbu@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 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.
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue7806>
> _______________________________________
> _______________________________________________
> Python-bugs-list mailing list
> Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/jeremy%40alum.mit.edu
>
> |
|
Date |
User |
Action |
Args |
2010-02-19 22:57:07 | jhylton | set | recipients:
+ jhylton, sijinjoseph, Robert.Buchholz |
2010-02-19 22:57:05 | jhylton | link | issue7806 messages |
2010-02-19 22:57:05 | jhylton | create | |
|