Permalink
Browse files

Merging new release version: 1.20

  • Loading branch information...
2 parents bb7e668 + 3b8823d commit 50705abd83be4ad7997eeefe9e732564af1db118 @Lukasa Lukasa committed Jan 19, 2017
View
@@ -29,6 +29,8 @@ matrix:
include:
- python: 3.5
env: TOXENV=py35
+ - python: 3.6
+ env: TOXENV=py36
- python: pypy-5.4
env: TOXENV=pypy
- language: generic
@@ -46,6 +48,9 @@ matrix:
- language: generic
os: osx
env: TOXENV=py35
+ - language: generic
+ os: osx
+ env: TOXENV=py36
allow_failures:
- python: pypy-5.4
sudo: false
View
@@ -1,6 +1,49 @@
Changes
=======
+1.20 (2017-01-19)
+-----------------
+
+* Added support for waiting for I/O using selectors other than select,
+ improving urllib3's behaviour with large numbers of concurrent connections.
+ (Pull #1001)
+
+* Updated the date for the system clock check. (Issue #1005)
+
+* ConnectionPools now correctly consider hostnames to be case-insensitive.
+ (Issue #1032)
+
+* Outdated versions of PyOpenSSL now cause the PyOpenSSL contrib module
+ to fail when it is injected, rather than at first use. (Pull #1063)
+
+* Outdated versions of cryptography now cause the PyOpenSSL contrib module
+ to fail when it is injected, rather than at first use. (Issue #1044)
+
+* Automatically attempt to rewind a file-like body object when a request is
+ retried or redirected. (Pull #1039)
+
+* Fix some bugs that occur when modules incautiously patch the queue module.
+ (Pull #1061)
+
+* Prevent retries from occuring on read timeouts for which the request method
+ was not in the method whitelist. (Issue #1059)
+
+* Changed the PyOpenSSL contrib module to lazily load idna to avoid
+ unnecessarily bloating the memory of programs that don't need it. (Pull
+ #1076)
+
+* Add support for IPv6 literals with zone identifiers. (Pull #1013)
+
+* Added support for socks5h:// and socks4a:// schemes when working with SOCKS
+ proxies, and controlled remote DNS appropriately. (Issue #1035)
+
+
+1.19.1 (2016-11-16)
+-------------------
+
+* Fixed AppEngine import that didn't function on Python 3.5. (Pull #1025)
+
+
1.19 (2016-11-03)
-----------------
View
@@ -212,5 +212,17 @@ In chronological order:
* Added length_remaining to determine remaining data to be read.
* Added enforce_content_length to raise exception when incorrect content-length received.
+* Seth Michael Larson <sethmichaellarson@protonmail.com>
+ * Created selectors backport that supports PEP 475.
+
+* Alexandre Dias <alex.dias@smarkets.com>
+ * Don't retry on timeout if method not in whitelist
+
+* Moinuddin Quadri <moin18@gmail.com>
+ * Lazily load idna package
+
+* Tom White <s6yg1ez3@mail2tor.com>
+ * Made SOCKS handler differentiate socks5h from socks5 and socks4a from socks4.
+
* [Your name or handle] <[email or website]>
* [Brief summary of your changes]
View
@@ -8,6 +8,10 @@ urllib3
.. image:: https://readthedocs.org/projects/urllib3/badge/?version=latest
:alt: Documentation Status
:target: https://urllib3.readthedocs.io/en/latest/
+
+.. image:: https://img.shields.io/codecov/c/github/shazow/urllib3.svg
+ :alt: Coverage Status
+ :target: https://codecov.io/gh/shazow/urllib3
.. image:: https://img.shields.io/pypi/v/urllib3.svg?maxAge=86400
:alt: PyPI version
View
@@ -43,6 +43,10 @@ if [[ "$(uname -s)" == 'Darwin' ]]; then
pyenv install 3.5.2
pyenv global 3.5.2
;;
+ py36)
+ pyenv install 3.6.0
+ pyenv global 3.6.0
+ ;;
pypy*)
pyenv install "pypy-5.4.1"
pyenv global "pypy-5.4.1"
@@ -8,3 +8,4 @@ wheel==0.24.0
tornado==4.2.1
PySocks==1.5.6
pkginfo>=1.0,!=1.3.0
+psutil==4.3.1
@@ -158,8 +158,12 @@ def upload(self, request):
def redirect(self, request):
"Perform a redirect to ``target``"
target = request.params.get('target', '/')
+ status = request.params.get('status', '303 See Other')
+ if len(status) == 3:
+ status = '%s Redirect' % status.decode('latin-1')
+
headers = [('Location', target)]
- return Response(status='303 See Other', headers=headers)
+ return Response(status=status, headers=headers)
def multi_redirect(self, request):
"Performs a redirect chain based on ``redirect_codes``"
@@ -327,6 +331,7 @@ def _parse_header(line):
pdict[name] = value
return key, pdict
+
# TODO: make the following conditional as soon as we know a version
# which does not require this fix.
# See https://github.com/facebook/tornado/issues/868
@@ -129,6 +129,7 @@ def run_proxy(port, start_ioloop=True):
if start_ioloop:
ioloop.start()
+
if __name__ == '__main__':
port = 8888
if len(sys.argv) > 1:
@@ -72,6 +72,7 @@ def _has_ipv6(host):
sock.close()
return has_ipv6
+
# Some systems may have IPv6 support but DNS may not be configured
# properly. We can not count that localhost will resolve to ::1 on all
# systems. See https://github.com/shazow/urllib3/pull/611 and
@@ -119,7 +120,7 @@ def _start_server(self):
self.port = sock.getsockname()[1]
# Once listen() returns, the server socket is ready
- sock.listen(0)
+ sock.listen(1)
if self.ready_event:
self.ready_event.set()
@@ -1,4 +1,4 @@
-import unittest
+import sys
import socket
import threading
from nose.plugins.skip import SkipTest
@@ -13,6 +13,11 @@
from dummyserver.handlers import TestingApp
from dummyserver.proxy import ProxyHandler
+if sys.version_info >= (2, 7):
+ import unittest
+else:
+ import unittest2 as unittest
+
def consume_socket(sock, chunks=65536):
while not sock.recv(chunks).endswith(b'\r\n\r\n'):
View
@@ -88,30 +88,40 @@ def wrapper(*args, **kwargs):
return test(*args, **kwargs)
return wrapper
+_requires_network_has_route = None
def requires_network(test):
"""Helps you skip tests that require the network"""
def _is_unreachable_err(err):
return getattr(err, 'errno', None) in (errno.ENETUNREACH,
errno.EHOSTUNREACH) # For OSX
- @functools.wraps(test)
- def wrapper(*args, **kwargs):
- msg = "Can't run {name} because the network is unreachable".format(
- name=test.__name__)
+ def _has_route():
try:
- return test(*args, **kwargs)
+ sock = socket.create_connection((TARPIT_HOST, 80), 0.0001)
+ sock.close()
+ return True
+ except socket.timeout:
+ return True
except socket.error as e:
- # This test needs an initial network connection to attempt the
- # connection to the TARPIT_HOST. This fails if you are in a place
- # without an Internet connection, so we skip the test in that case.
if _is_unreachable_err(e):
- raise SkipTest(msg)
- raise
- except MaxRetryError as e:
- if _is_unreachable_err(e.reason):
- raise SkipTest(msg)
- raise
+ return False
+ else:
+ raise
+
+ @functools.wraps(test)
+ def wrapper(*args, **kwargs):
+ global _requires_network_has_route
+
+ if _requires_network_has_route is None:
+ _requires_network_has_route = _has_route()
+
+ if _requires_network_has_route:
+ return test(*args, **kwargs)
+ else:
+ msg = "Can't run {name} because the network is unreachable".format(
+ name=test.__name__)
+ raise SkipTest(msg)
return wrapper
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+import unittest
+
+from nose.plugins.skip import SkipTest
+
+try:
+ from urllib3.contrib.pyopenssl import (inject_into_urllib3,
+ extract_from_urllib3)
+except ImportError as e:
+ raise SkipTest('Could not import PyOpenSSL: %r' % e)
+
+from mock import patch, Mock
+
+class TestPyOpenSSLInjection(unittest.TestCase):
+ """
+ Tests for error handling in pyopenssl's 'inject_into urllib3'
+ """
+ def test_inject_validate_fail_cryptography(self):
+ """
+ Injection should not be supported if cryptography is too old.
+ """
+ try:
+ with patch("cryptography.x509.extensions.Extensions") as mock:
+ del mock.get_extension_for_class
+ self.assertRaises(ImportError, inject_into_urllib3)
+ finally:
+ # `inject_into_urllib3` is not supposed to succeed.
+ # If it does, this test should fail, but we need to
+ # clean up so that subsequent tests are unaffected.
+ extract_from_urllib3()
+
+ def test_inject_validate_fail_pyopenssl(self):
+ """
+ Injection should not be supported if pyOpenSSL is too old.
+ """
+ try:
+ return_val = Mock()
+ del return_val._x509
+ with patch("OpenSSL.crypto.X509", return_value=return_val) as mock:
+ self.assertRaises(ImportError, inject_into_urllib3)
+ finally:
+ # `inject_into_urllib3` is not supposed to succeed.
+ # If it does, this test should fail, but we need to
+ # clean up so that subsequent tests are unaffected.
+ extract_from_urllib3()
Oops, something went wrong.

0 comments on commit 50705ab

Please sign in to comment.