Message87585
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:16 | JonathansCorner.com | set | recipients:
+ JonathansCorner.com, janssen, pitrou, dugan, csapuntz |
2009-05-11 20:47:16 | JonathansCorner.com | set | messageid: <1242074836.0.0.301258335649.issue5238@psf.upfronthosting.co.za> |
2009-05-11 20:47:14 | JonathansCorner.com | link | issue5238 messages |
2009-05-11 20:47:14 | JonathansCorner.com | create | |
|