Update urllib3 to a43319f
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Audrius Butkevicius · committed by Audrius Butkevicius · parent e0df216 · 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
Provenance
- Commit
9f119ee- Tree
e6a859e- Author
Audrius Butkevicius <audrius.butkevicius@elastichosts.com>- Committer
Audrius Butkevicius <audrius.butkevicius@elastichosts.com>- Parent
e0df216
4 files changed+23 added−18 removed
modified:requests/packages/urllib3/contrib/pyopenssl.py+3 added
104 unmodified lines105 def __init__(self, connection, socket):106 self.connection = connection107 self.socket = socket108 109+ def fileno(self):110+ return self.socket.fileno()111+112 def makefile(self, mode, bufsize=-1):113 return _fileobject(self.connection, mode, bufsize)114 115 def settimeout(self, timeout):58 unmodified linesmodified:requests/packages/urllib3/_collections.py+8 added-8 removed
3 unmodified lines4 # This module is part of urllib3 and is released under5 # the MIT License: http://www.opensource.org/licenses/mit-license.php6 7 from collections import MutableMapping8-from threading import Lock8+from threading import RLock9 10 try: # Python 2.7+11 from collections import OrderedDict12 except ImportError:26 unmodified lines39 self._maxsize = maxsize40 self.dispose_func = dispose_func41 42 self._container = self.ContainerCls()43- self._lock = Lock()43+ self.lock = RLock()44 45 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 item51 52 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 lines64 if self.dispose_func and evicted_value is not _Null:65 self.dispose_func(evicted_value)66 67 def __delitem__(self, key):68- with self._lock:68+ with self.lock:69 value = self._container.pop(key)70 71 if self.dispose_func:72 self.dispose_func(value)73 74 def __len__(self):75- with self._lock:75+ with self.lock:76 return len(self._container)77 78 def __iter__(self):79 raise NotImplementedError('Iteration over this class is unlikely to be threadsafe.')80 81 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 lines89 for value in values:90 self.dispose_func(value)91 92 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 lines103 port = port or port_by_scheme.get(scheme, 80)104 105 pool_key = (scheme, host, port)106 107+ 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 pool113 113- # 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 pool118 119 def connection_from_url(self, url):120 """82 unmodified linesmodified:requests/packages/urllib3/util.py+3 added-2 removed
111 unmodified lines112 """113 114 # 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.118 119 scheme = None120 auth = None20 unmodified lines141 auth, url = url.split('@', 1)142 143 # IPv6144 if url and url[0] == '[':145- host, url = url[1:].split(']', 1)145+ host, url = url.split(']', 1)146+ host += ']'147 148 # Port149 if ':' in url:150 _host, port = url.split(':', 1)242 unmodified lines