[issue9881] PySSL_SSLRead loops until data is available, even in non-blocking mode

Jean-Paul Calderone report at bugs.python.org
Fri Sep 17 00:22:59 CEST 2010


New submission from Jean-Paul Calderone <invalid at example.invalid>:

Here's a transcript which demonstrates the blocking behavior:

>>> import socket
>>> import time
>>> import ssl
>>> s = ssl.wrap_socket(socket.socket())
>>> s.connect(('localhost', 8443))
>>> s.send('GET /async.rpy HTTP/1.1\r\n\r\n')
27
>>> s.setblocking(False)
>>> a = time.time(); s.recv(1024); b = time.time()
'HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\nDate: Thu, 02 Sep 2010 11:51:03 GMT\r\nContent-Type: text/html\r\nServer: TwistedWeb/10.1.0+r29954\r\n\r\n4c\r\n<html><body>Sorry to keep you waiting.</body></html>\r\n0\r\n\r\n'
>>> print b - a
4.13403391838
>>>

(This can be reproduced using any web server which is a bit slow in responding; it's very obvious here because I used a server that intentionally waits several seconds before generating a response).

----------
components: Library (Lib)
messages: 116629
nosy: exarkun
priority: normal
severity: normal
status: open
title: PySSL_SSLRead loops until data is available, even in non-blocking mode
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9881>
_______________________________________


More information about the Python-bugs-list mailing list