Jonathan Hayward <jonathan.hayw...@pobox.com> added the comment: 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. ---------- Added file: http://bugs.python.org/file13958/test.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5238> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com