Merge pull request #1500 from gavrie/master

Update urllib3 to d89d508
This commit is contained in:
Kenneth Reitz
2013-07-31 18:23:43 -07:00
4 changed files with 22 additions and 13 deletions
+7 -7
View File
@@ -26,7 +26,10 @@ except ImportError:
try: # Compiled with SSL?
HTTPSConnection = object
BaseSSLError = None
class BaseSSLError(BaseException):
pass
ssl = None
try: # Python 3
@@ -152,8 +155,8 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
:class:`httplib.HTTPConnection`.
:param timeout:
Socket timeout for each individual connection, can be a float. None
disables timeout.
Socket timeout in seconds for each individual connection, can be
a float. None disables timeout.
:param maxsize:
Number of connections to save that can be reused. More than 1 is useful
@@ -376,6 +379,7 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
:param timeout:
If specified, overrides the default timeout for this one request.
It may be a float (in seconds).
:param pool_timeout:
If set and the pool is set to block=True, then this method will
@@ -410,10 +414,6 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
# Check host
if assert_same_host and not self.is_same_host(url):
host = "%s://%s" % (self.scheme, self.host)
if self.port:
host = "%s:%d" % (host, self.port)
raise HostChangedError(self, url, retries - 1)
conn = None
+3 -3
View File
@@ -181,9 +181,9 @@ class ProxyManager(RequestMethods):
"""
headers_ = {'Accept': '*/*'}
host = parse_url(url).host
if host:
headers_['Host'] = host
netloc = parse_url(url).netloc
if netloc:
headers_['Host'] = netloc
if headers:
headers_.update(headers)
+5 -3
View File
@@ -185,9 +185,11 @@ class HTTPResponse(io.IOBase):
try:
if decode_content and self._decoder:
data = self._decoder.decompress(data)
except (IOError, zlib.error):
raise DecodeError("Received response with content-encoding: %s, but "
"failed to decode it." % content_encoding)
except (IOError, zlib.error) as e:
raise DecodeError(
"Received response with content-encoding: %s, but "
"failed to decode it." % content_encoding,
e)
if flush_decoder and self._decoder:
buf = self._decoder.decompress(binary_type())
+7
View File
@@ -60,6 +60,13 @@ class Url(namedtuple('Url', ['scheme', 'auth', 'host', 'port', 'path', 'query',
return uri
@property
def netloc(self):
"""Network location including host and port"""
if self.port:
return '%s:%d' % (self.host, self.port)
return self.host
def split_first(s, delims):
"""