From 34c8d9830699c9695284862b879e28480596330d Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Wed, 4 Mar 2015 20:51:55 +0100 Subject: Issue #23576: Avoid stalling in SSL reads when EOF has been reached in the SSL layer but the underlying connection hasn't been closed. --- Modules/_ssl.c | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'Modules/_ssl.c') diff --git a/Modules/_ssl.c b/Modules/_ssl.c index e0d888e389..f9d66a1dd9 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -1720,26 +1720,6 @@ static PyObject *PySSL_SSLread(PySSLSocket *self, PyObject *args) BIO_set_nbio(SSL_get_rbio(self->ssl), nonblocking); BIO_set_nbio(SSL_get_wbio(self->ssl), nonblocking); - /* first check if there are bytes ready to be read */ - PySSL_BEGIN_ALLOW_THREADS - count = SSL_pending(self->ssl); - PySSL_END_ALLOW_THREADS - - if (!count) { - sockstate = check_socket_and_wait_for_timeout(sock, 0); - if (sockstate == SOCKET_HAS_TIMED_OUT) { - PyErr_SetString(PySSLErrorObject, - "The read operation timed out"); - goto error; - } else if (sockstate == SOCKET_TOO_LARGE_FOR_SELECT) { - PyErr_SetString(PySSLErrorObject, - "Underlying socket too large for select()."); - goto error; - } else if (sockstate == SOCKET_HAS_BEEN_CLOSED) { - count = 0; - goto done; - } - } do { PySSL_BEGIN_ALLOW_THREADS count = SSL_read(self->ssl, mem, len); -- cgit v1.2.1