Recipients, csapuntz, dugan, janssen, pitrou
Date 2009-05-11.20:47:12
SpamBayes Score 1.66533e-16
Marked as misclassified No
Message-id <>
Constantine Sapuntzakis wrote:
> import ssl
> # Work around python bug #5328
> def SSLSocket_makefile_fixed(self, mode='r', bufsize=-1):
>     from socket import _fileobject
>     self._makefile_refs += 1
>     return _fileobject(self, mode, bufsize, True)
> ssl.SSLSocket.makefile = SSLSocket_makefile_fixed

Is it possible this workaround has a bug?

In my production code the socket remains open both after this
monkeypatch and after manually closing the underlying socket. In the
attached test case (TLS certificate and keyfile referenced but not
included), a server does the following:

1: listens to a single HTTPS request on port 8443.
2: Serves a "Hello, world!" page.
3: Closes the connection.
4: Sleeps for five seconds.
5: Exits the process.

The server incorporates the quoted patch, and the behavior from within
Firefox is that it serves up a "Hello world!" page via
https://localhost:8443/ and the connection remains open for five seconds
until the server process exits, apparently indicating a connection that
remains open as long as the process is running.

Closing the underlying connection manually seems to work.
Date User Action Args
2009-05-11 20:47:16JonathansCorner.comsetrecipients: +, janssen, pitrou, dugan, csapuntz
2009-05-11 20:47:16JonathansCorner.comsetmessageid: <>
2009-05-11 20:47:14JonathansCorner.comlinkissue5238 messages
2009-05-11 20:47:14JonathansCorner.comcreate