Skip to content

Instantly share code, notes, and snippets.

@Lukasa
Created April 24, 2017 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lukasa/7c4cdba45bd9c142c32fc0a221d78b59 to your computer and use it in GitHub Desktop.
Save Lukasa/7c4cdba45bd9c142c32fc0a221d78b59 to your computer and use it in GitHub Desktop.
Short read fix.
commit ebef3775f0ab40820f5a118b632d5e1f0c7d1121
Author: Cory Benfield <lukasaoz@gmail.com>
Date: Mon Apr 24 17:23:29 2017 +0100
Read short on EOF
diff --git a/urllib3/contrib/securetransport.py b/urllib3/contrib/securetransport.py
index 84d213f..cd840a6 100644
--- a/urllib3/contrib/securetransport.py
+++ b/urllib3/contrib/securetransport.py
@@ -517,6 +517,10 @@ class WrappedSocket(object):
return data
def recv_into(self, buffer, nbytes=None):
+ # Read short on EOF.
+ if self._closed:
+ return 0
+
if nbytes is None:
nbytes = len(buffer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment