Update urllib3 to a27758625e4169330fcf965652b1093faf5aaaa2
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Ian Cordasco · committed by Ian Cordasco · parent a57eacf · Browse files · 4 files·+35 added−17 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+35 added−17 removed
- other:+35 added−17 removed
Provenance
- Commit
d2d576b- Tree
ced4118- Author
Ian Cordasco <graffatcolmingov@gmail.com>- Committer
Ian Cordasco <graffatcolmingov@gmail.com>- Parent
a57eacf
4 files changed+35 added−17 removed
modified:requests/packages/urllib3/contrib/pyopenssl.py+5 added
189 unmodified lines190 if self.suppress_ragged_eofs and e.args == (-1, 'Unexpected EOF'):191 return b''192 else:193 raise194+ except OpenSSL.SSL.ZeroReturnError as e:195+ if self.connection.get_shutdown() == OpenSSL.SSL.RECEIVED_SHUTDOWN:196+ return b''197+ else:198+ raise199 except OpenSSL.SSL.WantReadError:200 rd, wd, ed = select.select(201 [self.socket], [], [], self.socket.gettimeout())202 if not rd:106 unmodified linesmodified:requests/packages/urllib3/util/retry.py+1 added-1 removed
188 unmodified lines189 """190 return isinstance(err, (ReadTimeoutError, ProtocolError))191 192 def is_forced_retry(self, method, status_code):193- """ Is this method/response retryable? (Based on method/codes whitelists)193+ """ Is this method/status code retryable? (Based on method/codes whitelists)194 """195 if self.method_whitelist and method.upper() not in self.method_whitelist:196 return False197 88 unmodified linesmodified:requests/packages/urllib3/__init__.py+1 added-1 removed
53 unmodified lines54 # ... Clean up.55 del NullHandler56 57 58-# Set security warning to only go off once by default.58+# Set security warning to always go off by default.59 import warnings60 warnings.simplefilter('always', exceptions.SecurityWarning)61 62 def disable_warnings(category=exceptions.HTTPWarning):4 unmodified linesmodified:requests/packages/urllib3/connectionpool.py+28 added-15 removed
264 unmodified lines265 Called right before a request is made, after the socket is created.266 """267 pass268 269+ def _prepare_proxy(self, conn):270+ # Nothing to do for HTTP connections.271+ pass272+273 def _get_timeout(self, timeout):274 """ Helper that always returns a :class:`urllib3.util.Timeout` """275 if timeout is _Default:276 return self.timeout.clone()236 unmodified lines513 err = None514 515 try:516 # Request a connection from the queue.517+ timeout_obj = self._get_timeout(timeout)518 conn = self._get_conn(timeout=pool_timeout)519 520+ conn.timeout = timeout_obj.connect_timeout521+522+ is_new_proxy_conn = self.proxy is not None and not getattr(conn, 'sock', None)523+ if is_new_proxy_conn:524+ self._prepare_proxy(conn)525+526 # Make the request on the httplib connection object.527 httplib_response = self._make_request(conn, method, url,517- timeout=timeout,528+ timeout=timeout_obj,529 body=body, headers=headers)530 531 # If we're going to release the connection in ``finally:``, then532 # the request doesn't need to know about the connection. Otherwise150 unmodified lines683 assert_hostname=self.assert_hostname,684 assert_fingerprint=self.assert_fingerprint)685 conn.ssl_version = self.ssl_version686 676- if self.proxy is not None:677- # Python 2.7+678- try:679- set_tunnel = conn.set_tunnel680- except AttributeError: # Platform-specific: Python 2.6681- set_tunnel = conn._set_tunnel687+ return conn688 683- if sys.version_info <= (2, 6, 4) and not self.proxy_headers: # Python 2.6.4 and older684- set_tunnel(self.host, self.port)685- else:686- set_tunnel(self.host, self.port, self.proxy_headers)689+ def _prepare_proxy(self, conn):690+ """691+ Establish tunnel connection early, because otherwise httplib692+ would improperly set Host: header to proxy's IP:port.693+ """694+ # Python 2.7+695+ try:696+ set_tunnel = conn.set_tunnel697+ except AttributeError: # Platform-specific: Python 2.6698+ set_tunnel = conn._set_tunnel699 688- # Establish tunnel connection early, because otherwise httplib689- # would improperly set Host: header to proxy's IP:port.690- conn.connect()700+ if sys.version_info <= (2, 6, 4) and not self.proxy_headers: # Python 2.6.4 and older701+ set_tunnel(self.host, self.port)702+ else:703+ set_tunnel(self.host, self.port, self.proxy_headers)704 692- return conn705+ conn.connect()706 707 def _new_conn(self):708 """709 Return a fresh :class:`httplib.HTTPSConnection`.65 unmodified lines