Constantine Sapuntzakis <csapu...@gmail.com> added the comment:
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
implementation:
In the do_GET() method of my web server I called:
self.rfile._sock.close()
self.wfile._sock.close()
-Costa
On Fri, May 8, 2009 at 12:51 PM, Jonathan Hayward <rep...@bugs.python.org>wrote:
>
> Jonathan Hayward <jonathan.hayw...@pobox.com> 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, http://JonathansCorner.com/
>
> ----------
> nosy: +JonathansCorner.com
>
> _______________________________________
> Python tracker <rep...@bugs.python.org>
> <http://bugs.python.org/issue5238>
> _______________________________________
>
----------
Added file: http://bugs.python.org/file13935/unnamed
_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue5238>
_______________________________________
Here is the workaround I'm using until the code gets fixed:<br><br>import
ssl<br><br># Work around python bug #5328<br>def SSLSocket_makefile_fixed(self,
mode='r', bufsize=-1):<br>Â Â Â from socket import _fileobject<br>
   <br>   self._makefile_refs += 1<br>   return _fileobject(self,
mode, bufsize, True)<br><br>ssl.SSLSocket.makefile =
SSLSocket_makefile_fixed<br><br><br>An alternate way to fix it is to reach in
to the _fileobject wrapper and close the underlying<br>
implementation:<br><br>In the do_GET() method of my web server I
called:<br><br>self.rfile._sock.close()<br>self.wfile._sock.close()<br><br>-Costa<br><br><br><div
class="gmail_quote">On Fri, May 8, 2009 at 12:51 PM, Jonathan Hayward <span
dir="ltr"><<a
href="mailto:rep...@bugs.python.org">rep...@bugs.python.org</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204,
204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Jonathan Hayward <<a
href="mailto:jonathan.hayw...@pobox.com">jonathan.hayw...@pobox.com</a>>
added the comment:<br>
<br>
Is there a workaround to close a TLS socket and its underlying socket?<br>
<br>
I was making something to use https for a simple operation, and it the<br>
browser acted as if the socket never closed. If I followed the close of<br>
the ssl socket by a close of the underlying socket, I didn't get errors,<br>
but the browser throbber acted as if the connection was still open.<br>
<br>
Jonathan, <a href="http://JonathansCorner.com/"
target="_blank">http://JonathansCorner.com/</a><br>
<br>
----------<br>
nosy: +JonathansCorner.com<br>
<br>
_______________________________________<br>
Python tracker <<a
href="mailto:rep...@bugs.python.org">rep...@bugs.python.org</a>><br>
<<a href="http://bugs.python.org/issue5238"
target="_blank">http://bugs.python.org/issue5238</a>><br>
_______________________________________<br>
</blockquote></div><br>
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com