Skip to content
Myr

Merge pull request #1463 from AudriusButkevicius/master

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

Update urllib3 to a43319f

authored by Kenneth Reitz · committed by Kenneth Reitz · parents e0df216, 9f119ee · Browse files · 4 files+23 added−18 removed
This commit

State

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

Diff stats

4 files+23 added−18 removed

  • other:+23 added−18 removed

4 files+23 added−18 removed

modified:requests/packages/urllib3/contrib/pyopenssl.py+3 added
104 unmodified lines
105 def __init__(self, connection, socket):106 self.connection = connection107 self.socket = socket108109 def fileno(self):110 return self.socket.fileno()111112 def makefile(self, mode, bufsize=-1):113 return _fileobject(self.connection, mode, bufsize)114115 def settimeout(self, timeout):
58 unmodified lines
modified:requests/packages/urllib3/_collections.py+8 added-8 removed
3 unmodified lines
4# This module is part of urllib3 and is released under5# the MIT License: http://www.opensource.org/licenses/mit-license.php67from collections import MutableMapping8from threading import Lock8from threading import RLock910try: # Python 2.7+11 from collections import OrderedDict12except ImportError:
26 unmodified lines
39 self._maxsize = maxsize40 self.dispose_func = dispose_func4142 self._container = self.ContainerCls()43 self._lock = Lock()43 self.lock = RLock()4445 def __getitem__(self, key):46 # Re-insert the item, moving it to the end of the eviction line.47 with self._lock:47 with self.lock:48 item = self._container.pop(key)49 self._container[key] = item50 return item5152 def __setitem__(self, key, value):53 evicted_value = _Null54 with self._lock:54 with self.lock:55 # Possibly evict the existing value of 'key'56 evicted_value = self._container.get(key, _Null)57 self._container[key] = value58
5 unmodified lines
64 if self.dispose_func and evicted_value is not _Null:65 self.dispose_func(evicted_value)6667 def __delitem__(self, key):68 with self._lock:68 with self.lock:69 value = self._container.pop(key)7071 if self.dispose_func:72 self.dispose_func(value)7374 def __len__(self):75 with self._lock:75 with self.lock:76 return len(self._container)7778 def __iter__(self):79 raise NotImplementedError('Iteration over this class is unlikely to be threadsafe.')8081 def clear(self):82 with self._lock:82 with self.lock:83 # Copy pointers to all values, then wipe the mapping84 # under Python 2, this copies the list of values twice :-|85 values = list(self._container.values())86 self._container.clear()
2 unmodified lines
89 for value in values:90 self.dispose_func(value)9192 def keys(self):93 with self._lock:93 with self.lock:94 return self._container.keys()
modified:requests/packages/urllib3/poolmanager.py+9 added-8 removed
102 unmodified lines
103 port = port or port_by_scheme.get(scheme, 80)104105 pool_key = (scheme, host, port)106107 with self.pools.lock:107 # If the scheme, host, or port doesn't match existing open connections,108 # open a new ConnectionPool.109 pool = self.pools.get(pool_key)110 if pool:111 return pool108 # If the scheme, host, or port doesn't match existing open connections,109 # open a new ConnectionPool.110 pool = self.pools.get(pool_key)111 if pool:112 return pool113113 # Make a fresh ConnectionPool of the desired type114 pool = self._new_pool(scheme, host, port)115 self.pools[pool_key] = pool114 # Make a fresh ConnectionPool of the desired type115 pool = self._new_pool(scheme, host, port)116 self.pools[pool_key] = pool117 return pool118119 def connection_from_url(self, url):120 """
82 unmodified lines
modified:requests/packages/urllib3/util.py+3 added-2 removed
111 unmodified lines
112 """113114 # While this code has overlap with stdlib's urlparse, it is much115 # simplified for our needs and less annoying.116 # Additionally, this imeplementations does silly things to be optimal116 # Additionally, this implementations does silly things to be optimal117 # on CPython.118119 scheme = None120 auth = None
20 unmodified lines
141 auth, url = url.split('@', 1)142143 # IPv6144 if url and url[0] == '[':145 host, url = url[1:].split(']', 1)145 host, url = url.split(']', 1)146 host += ']'147148 # Port149 if ':' in url:150 _host, port = url.split(':', 1)
242 unmodified lines