This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Arfrever, alex, benjamin.peterson, christian.heimes, dstufft, geertj, giampaolo.rodola, glyph, janssen, ncoghlan, pitrou, vstinner
Date 2017-06-12.16:00:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1497283217.02.0.8416942681.issue22559@psf.upfronthosting.co.za>
In-reply-to
Content
I converted issue22559.diff to a pull request. I only had one conflict!

--- Lib/ssl.py
+++ Lib/ssl.py
@@ -727,11 +857,7 @@ class SSLSocket(socket):
         if not self._sslobj:
             raise ValueError("Read on closed or unwrapped SSL socket.")
         try:
-            if buffer is not None:
-                v = self._sslobj.read(len, buffer)
-            else:
-                v = self._sslobj.read(len or 1024)
-            return v
+            return self._sslobj.read(len, buffer)
         except SSLError as x:
             if x.args[0] == SSL_ERROR_EOF and self.suppress_ragged_eofs:
                 if buffer is not None:

I fixed it by using "return self._sslobj.read(len, buffer)".

I added a second commit to synchronize Lib/ssl.py with master:

* add selected_alpn_protocol() method, needed by test_ssl
* change how the default size of read() is defined
* change how send()/write result is reported: handle SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE

I tagged my PR as [WIP] since I'm not sure if I backported bpo-20951 "SSLSocket.send() returns 0 for non-blocking socket" by mistake or not :-)

Please review the PR carefully!
History
Date User Action Args
2017-06-12 16:00:17vstinnersetrecipients: + vstinner, geertj, ncoghlan, janssen, pitrou, giampaolo.rodola, christian.heimes, benjamin.peterson, glyph, Arfrever, alex, dstufft
2017-06-12 16:00:17vstinnersetmessageid: <1497283217.02.0.8416942681.issue22559@psf.upfronthosting.co.za>
2017-06-12 16:00:17vstinnerlinkissue22559 messages
2017-06-12 16:00:16vstinnercreate