Skip to content
Myr

Update urllib3 to cffbd6b317

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Cory Benfield · committed by Cory Benfield · parent 25db83f · Browse files · 2 files+38 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+38 added−1 removed

  • other:+38 added−1 removed

2 files+38 added−1 removed

modified:requests/packages/urllib3/response.py+24 added
9 unmodified lines
10import io1112from .exceptions import DecodeError13from .packages.six import string_types as basestring, binary_type14from .util import is_fp_closed151617log = logging.getLogger(__name__)18
182 unmodified lines
201 finally:202 if self._original_response and self._original_response.isclosed():203 self.release_conn()204205 def stream(self, amt=2**16, decode_content=None):206 """207 A generator wrapper for the read() method. A call will block until208 ``amt`` bytes have been read from the connection or until the209 connection is closed.210211 :param amt:212 How much of the content to read. The generator will return up to213 much data per iteration, but may return less. This is particularly214 likely when using compressed data. However, the empty string will215 never be returned.216217 :param decode_content:218 If True, will attempt to decode the body based on the219 'content-encoding' header.220 """221 while not is_fp_closed(self._fp):222 data = self.read(amt=amt, decode_content=decode_content)223224 if data:225 yield data226227228 @classmethod229 def from_httplib(ResponseCls, r, **response_kw):230 """231 Given an :class:`httplib.HTTPResponse` instance ``r``, return a
67 unmodified lines
modified:requests/packages/urllib3/util.py+14 added-1 removed
29 unmodified lines
30 from ssl import HAS_SNI # Has SNI?31except ImportError:32 pass333434from .packages import six35from .exceptions import LocationParseError, SSLError3637
301 unmodified lines
339 raise SSLError('Fingerprints did not match. Expected "{0}", got "{1}".'340 .format(hexlify(fingerprint_bytes),341 hexlify(cert_digest)))342343def is_fp_closed(obj):344 """345 Checks whether a given file-like object is closed.346347 :param obj:348 The file-like object to check.349 """350 if hasattr(obj, 'fp'):351 # Object is a container for another file-like object that gets released352 # on exhaustion (e.g. HTTPResponse)353 return obj.fp is None354355 return obj.closed356357358if SSLContext is not None: # Python 3.2+359 def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=None,360 ca_certs=None, server_hostname=None,361 ssl_version=None):
30 unmodified lines