update urllib3 to 60ba176f5d
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Thomas Weißschuh · committed by Thomas Weißschuh · parent 3bb13f8 · Browse files · 7 files·+52 added−6 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
7 files+52 added−6 removed
- other:+52 added−6 removed
Provenance
- Commit
2ed976e- Tree
f659668- Author
Thomas Weißschuh <thomas@t-8ch.de>- Committer
Thomas Weißschuh <thomas@t-8ch.de>- Parent
3bb13f8
7 files changed+52 added−6 removed
modified:requests/packages/urllib3/contrib/ntlmpool.py+1 added-1 removed
31 unmodified lines32 33 def __init__(self, user, pw, authurl, *args, **kwargs):34 """35 authurl is a random URL on the server that is protected by NTLM.36- user is the Windows user, probably in the DOMAIN\username format.36+ user is the Windows user, probably in the DOMAIN\\username format.37 pw is the password for the user.38 """39 super(NTLMConnectionPool, self).__init__(*args, **kwargs)40 self.authurl = authurl80 unmodified linesmodified:requests/packages/urllib3/contrib/pyopenssl.py+3 added
113 unmodified lines114 115 def sendall(self, data):116 return self.connection.sendall(data)117 118+ def close(self):119+ return self.connection.shutdown()120+121 def getpeercert(self, binary_form=False):122 x509 = self.connection.get_peer_certificate()123 if not x509:124 raise ssl.SSLError('')46 unmodified linesmodified:requests/packages/urllib3/connectionpool.py+2 added-1 removed
108 unmodified lines109 if resolved_cert_reqs != ssl.CERT_NONE:110 if self.assert_fingerprint:111 assert_fingerprint(self.sock.getpeercert(binary_form=True),112 self.assert_fingerprint)113- else:113+ elif self.assert_hostname is not False:114 match_hostname(self.sock.getpeercert(),115 self.assert_hostname or self.host)116 117 ## Pool objects394 unmodified lines512 instead of :class:`httplib.HTTPSConnection`.513 514 :class:`.VerifiedHTTPSConnection` uses one of ``assert_fingerprint``,515 ``assert_hostname`` and ``host`` in this order to verify connections.516+ If ``assert_hostname`` is False, no verification is done.517 518 The ``key_file``, ``cert_file``, ``cert_reqs``, ``ca_certs`` and519 ``ssl_version`` are only used if :mod:`ssl` is available and are fed into520 :meth:`urllib3.util.ssl_wrap_socket` to upgrade the connection socket78 unmodified linesmodified:requests/packages/urllib3/filepost.py+1 added-1 removed
1 # urllib3/filepost.py2-# Copyright 2008-2012 Andrey Petrov and contributors (see CONTRIBUTORS.txt)2+# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)3 #4 # This module is part of urllib3 and is released under5 # the MIT License: http://www.opensource.org/licenses/mit-license.php6 92 unmodified linesmodified:requests/packages/urllib3/poolmanager.py+9 added
4 unmodified lines5 # the MIT License: http://www.opensource.org/licenses/mit-license.php6 7 import logging8 9+try: # Python 310+ from urllib.parse import urljoin11+except ImportError:12+ from urlparse import urljoin13+14 from ._collections import RecentlyUsedContainer15 from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool16 from .connectionpool import connection_from_url, port_by_scheme17 from .request import RequestMethods131 unmodified lines149 redirect_location = redirect and response.get_redirect_location()150 if not redirect_location:151 return response152 153+ # Support relative URLs for redirecting.154+ redirect_location = urljoin(url, redirect_location)155+156+ # RFC 2616, Section 10.3.4157 if response.status == 303:158 method = 'GET'159 160 log.info("Redirecting %s -> %s" % (url, redirect_location))41 unmodified linesmodified:requests/packages/urllib3/request.py+1 added-1 removed
28 unmodified lines29 :meth:`.request_encode_url` is for sending requests whose fields are encoded30 in the URL (such as GET, HEAD, DELETE).31 32 :meth:`.request_encode_body` is for sending requests whose fields are33- encoded in the *body* of the request using multipart or www-orm-urlencoded33+ encoded in the *body* of the request using multipart or www-form-urlencoded34 (such as for POST, PUT, PATCH).35 36 :meth:`.request` is for making any kind of request, it will look up the37 appropriate encoding format and use one of the above two methods to make105 unmodified linesmodified:requests/packages/urllib3/response.py+35 added-2 removed
1 # urllib3/response.py2-# Copyright 2008-2012 Andrey Petrov and contributors (see CONTRIBUTORS.txt)2+# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)3 #4 # This module is part of urllib3 and is released under5 # the MIT License: http://www.opensource.org/licenses/mit-license.php6 7 8 import logging9 import zlib10+import io11 12 from .exceptions import DecodeError13 from .packages.six import string_types as basestring, binary_type14 33 unmodified lines48 49 return DeflateDecoder()50 51 51-class HTTPResponse(object):52+class HTTPResponse(io.IOBase):53 """54 HTTP Response container.55 56 Backwards-compatible to httplib's HTTPResponse but the response ``body`` is182 unmodified lines239 return self.headers240 241 def getheader(self, name, default=None):242 return self.headers.get(name, default)243+244+ # Overrides from io.IOBase245+ def close(self):246+ if not self.closed:247+ self._fp.close()248+249+ @property250+ def closed(self):251+ if self._fp is None:252+ return True253+ elif hasattr(self._fp, 'closed'):254+ return self._fp.closed255+ elif hasattr(self._fp, 'isclosed'): # Python 2256+ return self._fp.isclosed()257+ else:258+ return True259+260+ def fileno(self):261+ if self._fp is None:262+ raise IOError("HTTPResponse has no file to get a fileno from")263+ elif hasattr(self._fp, "fileno"):264+ return self._fp.fileno()265+ else:266+ raise IOError("The file-like object this HTTPResponse is wrapped "267+ "around has no file descriptor")268+269+ def flush(self):270+ if self._fp is not None and hasattr(self._fp, 'flush'):271+ return self._fp.flush()272+273+ def readable(self):274+ return True