Skip to content

Commit

Permalink
Update urllib3 to v1.21.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasa committed May 9, 2017
1 parent 823519d commit d49f3e2
Show file tree
Hide file tree
Showing 18 changed files with 2,037 additions and 139 deletions.
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ Release History
- The dismayed person emoticon (``/o\\``) no longer has a big head. I'm sure
this is what you were all worrying about most.

**Miscellaneous**

- Updated bundled urllib3 to v1.21.1.

2.13.0 (2017-01-24)
+++++++++++++++++++

Expand Down
2 changes: 1 addition & 1 deletion requests/packages/urllib3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def emit(self, record):

__author__ = 'Andrey Petrov ([email protected])'
__license__ = 'MIT'
__version__ = '1.20'
__version__ = '1.21.1'

__all__ = (
'HTTPConnectionPool',
Expand Down
18 changes: 4 additions & 14 deletions requests/packages/urllib3/_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def __init__(self, headers=None, **kwargs):
self.extend(kwargs)

def __setitem__(self, key, val):
self._container[key.lower()] = (key, val)
self._container[key.lower()] = [key, val]
return self._container[key.lower()]

def __getitem__(self, key):
Expand Down Expand Up @@ -215,18 +215,11 @@ def add(self, key, val):
'bar, baz'
"""
key_lower = key.lower()
new_vals = key, val
new_vals = [key, val]
# Keep the common case aka no item present as fast as possible
vals = self._container.setdefault(key_lower, new_vals)
if new_vals is not vals:
# new_vals was not inserted, as there was a previous one
if isinstance(vals, list):
# If already several items got inserted, we have a list
vals.append(val)
else:
# vals should be a tuple then, i.e. only one item so far
# Need to convert the tuple to list for further extension
self._container[key_lower] = [vals[0], vals[1], val]
vals.append(val)

def extend(self, *args, **kwargs):
"""Generic import function for any type of header-like object.
Expand Down Expand Up @@ -262,10 +255,7 @@ def getlist(self, key):
except KeyError:
return []
else:
if isinstance(vals, tuple):
return [vals[1]]
else:
return vals[1:]
return vals[1:]

# Backwards compatibility for httplib
getheaders = getlist
Expand Down
4 changes: 4 additions & 0 deletions requests/packages/urllib3/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,11 @@ def connect(self):
assert_fingerprint(self.sock.getpeercert(binary_form=True),
self.assert_fingerprint)
elif context.verify_mode != ssl.CERT_NONE \
and not getattr(context, 'check_hostname', False) \
and self.assert_hostname is not False:
# While urllib3 attempts to always turn off hostname matching from
# the TLS library, this cannot always be done. So we check whether
# the TLS Library still thinks it's matching hostnames.
cert = self.sock.getpeercert()
if not cert.get('subjectAltName', ()):
warnings.warn((
Expand Down
Empty file.
Loading

0 comments on commit d49f3e2

Please sign in to comment.