Author csapuntz
Recipients, csapuntz, dugan, janssen
Date 2009-05-08.20:30:09
SpamBayes Score 9.49018e-09
Marked as misclassified No
Message-id <>
In-reply-to <>
Here is the workaround I'm using until the code gets fixed:

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

An alternate way to fix it is to reach in to the _fileobject wrapper and
close the underlying

In the do_GET() method of my web server I called:



On Fri, May 8, 2009 at 12:51 PM, Jonathan Hayward <>wrote:

> Jonathan Hayward <> added the comment:
> Is there a workaround to close a TLS socket and its underlying socket?
> I was making something to use https for a simple operation, and it the
> browser acted as if the socket never closed. If I followed the close of
> the ssl socket by a close of the underlying socket, I didn't get errors,
> but the browser throbber acted as if the connection was still open.
> Jonathan,
> ----------
> nosy:
> _______________________________________
> Python tracker <>
> <>
> _______________________________________
File name Uploaded
unnamed csapuntz, 2009-05-08.20:30:07
Date User Action Args
2009-05-08 20:30:10csapuntzsetrecipients: + csapuntz, janssen, dugan
2009-05-08 20:30:09csapuntzlinkissue5238 messages
2009-05-08 20:30:09csapuntzcreate