Disable buffering when using SecureTransport
MODIFY
urllib3/contrib/securetransport.py
urllib3/contrib/securetransport.py
@@ -685,7 +685,11 @@ if _fileobject: # Platform-specific: Python 2
self._makefile_refs += 1
return _fileobject(self, mode, bufsize, close=True)
else: # Platform-specific: Python 3
- makefile = backport_makefile
+ def makefile(self, mode="r", buffering=None, *args, **kwargs):
+ # We disable buffering with SecureTransport because it conflicts with
+ # the buffering that ST does internally (see issue #1153 for more).
+ buffering = 0
+ return backport_makefile(self, mode, buffering, *args, **kwargs)
WrappedSocket.makefile = makefile

Disable buffering when using SecureTransport