[Python-modules-commits] [python-urllib3] 02/10: Import python-urllib3_1.21.1.orig.tar.gz
Daniele Tricoli
eriol-guest at moszumanska.debian.org
Tue Jul 11 02:10:32 UTC 2017
This is an automated email from the git hooks/post-receive script.
eriol-guest pushed a commit to branch master
in repository python-urllib3.
commit 6dde9b057102818141f6e8dc08be3f479d082724
Author: Daniele Tricoli <eriol at mornie.org>
Date: Tue Jul 11 02:38:14 2017 +0200
Import python-urllib3_1.21.1.orig.tar.gz
---
CHANGES.rst | 85 +++
CONTRIBUTORS.txt | 18 +
PKG-INFO | 97 ++-
README.rst | 10 +-
dev-requirements.txt | 1 +
docs/advanced-usage.rst | 6 -
dummyserver/.DS_Store | Bin 0 -> 6148 bytes
dummyserver/certs/cacert.pem | 22 +-
dummyserver/certs/server.combined.pem | 36 ++
dummyserver/handlers.py | 6 +-
dummyserver/server.py | 7 +-
dummyserver/testcase.py | 7 +-
setup.cfg | 3 +-
setup.py | 2 +-
test/__init__.py | 76 ++-
test/benchmark.py | 6 +-
test/contrib/test_gae_manager.py | 5 +-
test/contrib/test_pyopenssl.py | 7 +-
test/contrib/test_pyopenssl_dependencies.py | 46 ++
test/contrib/test_securetransport.py | 21 +
test/contrib/test_socks.py | 105 ++-
test/port_helpers.py | 6 +-
test/socketpair_helper.py | 62 ++
test/test_collections.py | 27 +-
test/test_compatibility.py | 4 +-
test/test_connection.py | 19 +-
test/test_connectionpool.py | 43 +-
test/test_exceptions.py | 1 -
test/test_fields.py | 2 +-
test/test_filepost.py | 99 ++-
test/test_no_ssl.py | 9 +-
test/test_poolmanager.py | 183 ++++--
test/test_proxymanager.py | 10 +-
test/test_queue_monkeypatch.py | 37 ++
test/test_response.py | 29 +-
test/test_retry.py | 103 +--
test/test_selectors.py | 795 +++++++++++++++++++++++
test/test_util.py | 123 ++--
test/with_dummyserver/test_chunked_transfer.py | 9 +-
test/with_dummyserver/test_connectionpool.py | 232 +++++--
test/with_dummyserver/test_https.py | 71 ++-
test/with_dummyserver/test_no_ssl.py | 8 +-
test/with_dummyserver/test_poolmanager.py | 40 +-
test/with_dummyserver/test_proxy_poolmanager.py | 72 ++-
test/with_dummyserver/test_socketlevel.py | 308 +++++++--
urllib3.egg-info/PKG-INFO | 97 ++-
urllib3.egg-info/SOURCES.txt | 15 +-
urllib3/__init__.py | 2 +-
urllib3/_collections.py | 18 +-
urllib3/connection.py | 9 +-
urllib3/connectionpool.py | 68 +-
urllib3/contrib/_securetransport/__init__.py | 0
urllib3/contrib/_securetransport/bindings.py | 590 +++++++++++++++++
urllib3/contrib/_securetransport/low_level.py | 343 ++++++++++
urllib3/contrib/appengine.py | 2 +-
urllib3/contrib/pyopenssl.py | 41 +-
urllib3/contrib/securetransport.py | 807 ++++++++++++++++++++++++
urllib3/contrib/socks.py | 10 +
urllib3/exceptions.py | 5 +
urllib3/poolmanager.py | 187 ++++--
urllib3/response.py | 6 +-
urllib3/util/__init__.py | 8 +
urllib3/util/connection.py | 31 +-
urllib3/util/request.py | 48 +-
urllib3/util/retry.py | 41 +-
urllib3/util/selectors.py | 581 +++++++++++++++++
urllib3/util/ssl_.py | 1 +
urllib3/util/timeout.py | 7 +-
urllib3/util/url.py | 6 +-
urllib3/util/wait.py | 40 ++
70 files changed, 5215 insertions(+), 606 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index a36cbb1..917d9ad 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,11 +1,96 @@
Changes
=======
+1.21.1 (2017-05-02)
+-------------------
+
+* Fixed SecureTransport issue that would cause long delays in response body
+ delivery. (Pull #1154)
+
+* Fixed regression in 1.21 that threw exceptions when users passed the
+ ``socket_options`` flag to the ``PoolManager``. (Issue #1165)
+
+* Fixed regression in 1.21 that threw exceptions when users passed the
+ ``assert_hostname`` or ``assert_fingerprint`` flag to the ``PoolManager``.
+ (Pull #1157)
+
+
+1.21 (2017-04-25)
+-----------------
+
+* Improved performance of certain selector system calls on Python 3.5 and
+ later. (Pull #1095)
+
+* Resolved issue where the PyOpenSSL backend would not wrap SysCallError
+ exceptions appropriately when sending data. (Pull #1125)
+
+* Selectors now detects a monkey-patched select module after import for modules
+ that patch the select module like eventlet, greenlet. (Pull #1128)
+
+* Reduced memory consumption when streaming zlib-compressed responses
+ (as opposed to raw deflate streams). (Pull #1129)
+
+* Connection pools now use the entire request context when constructing the
+ pool key. (Pull #1016)
+
+* ``PoolManager.connection_from_*`` methods now accept a new keyword argument,
+ ``pool_kwargs``, which are merged with the existing ``connection_pool_kw``.
+ (Pull #1016)
+
+* Add retry counter for ``status_forcelist``. (Issue #1147)
+
+* Added ``contrib`` module for using SecureTransport on macOS:
+ ``urllib3.contrib.securetransport``. (Pull #1122)
+
+* urllib3 now only normalizes the case of ``http://`` and ``https://`` schemes:
+ for schemes it does not recognise, it assumes they are case-sensitive and
+ leaves them unchanged.
+ (Issue #1080)
+
+
+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)
-----------------
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 9ef5c69..cdd19fa 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -212,5 +212,23 @@ 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 at protonmail.com>
+ * Created selectors backport that supports PEP 475.
+
+* Alexandre Dias <alex.dias at smarkets.com>
+ * Don't retry on timeout if method not in whitelist
+
+* Moinuddin Quadri <moin18 at gmail.com>
+ * Lazily load idna package
+
+* Tom White <s6yg1ez3 at mail2tor.com>
+ * Made SOCKS handler differentiate socks5h from socks5 and socks4a from socks4.
+
+* Tim Burke <tim.burke at gmail.com>
+ * Stop buffering entire deflate-encoded responses.
+
+* Tuukka Mustonen <tuukka.mustonen at gmail.com>
+ * Add counter for status_forcelist retries.
+
* [Your name or handle] <[email or website]>
* [Brief summary of your changes]
diff --git a/PKG-INFO b/PKG-INFO
index 6bc2d4b..e6ba1c5 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: urllib3
-Version: 1.19.1
+Version: 1.21.1
Summary: HTTP library with thread-safe connection pooling, file post, and more.
Home-page: https://urllib3.readthedocs.io/
Author: Andrey Petrov
@@ -9,13 +9,21 @@ License: MIT
Description: urllib3
=======
- .. image:: https://travis-ci.org/shazow/urllib3.png?branch=master
+ .. image:: https://travis-ci.org/shazow/urllib3.svg?branch=master
:alt: Build status on Travis
:target: https://travis-ci.org/shazow/urllib3
+ .. image:: https://img.shields.io/appveyor/ci/shazow/urllib3/master.svg
+ :alt: Build status on AppVeyor
+ :target: https://ci.appveyor.com/project/shazow/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
@@ -94,11 +102,96 @@ Description: urllib3
Changes
=======
+ 1.21.1 (2017-05-02)
+ -------------------
+
+ * Fixed SecureTransport issue that would cause long delays in response body
+ delivery. (Pull #1154)
+
+ * Fixed regression in 1.21 that threw exceptions when users passed the
+ ``socket_options`` flag to the ``PoolManager``. (Issue #1165)
+
+ * Fixed regression in 1.21 that threw exceptions when users passed the
+ ``assert_hostname`` or ``assert_fingerprint`` flag to the ``PoolManager``.
+ (Pull #1157)
+
+
+ 1.21 (2017-04-25)
+ -----------------
+
+ * Improved performance of certain selector system calls on Python 3.5 and
+ later. (Pull #1095)
+
+ * Resolved issue where the PyOpenSSL backend would not wrap SysCallError
+ exceptions appropriately when sending data. (Pull #1125)
+
+ * Selectors now detects a monkey-patched select module after import for modules
+ that patch the select module like eventlet, greenlet. (Pull #1128)
+
+ * Reduced memory consumption when streaming zlib-compressed responses
+ (as opposed to raw deflate streams). (Pull #1129)
+
+ * Connection pools now use the entire request context when constructing the
+ pool key. (Pull #1016)
+
+ * ``PoolManager.connection_from_*`` methods now accept a new keyword argument,
+ ``pool_kwargs``, which are merged with the existing ``connection_pool_kw``.
+ (Pull #1016)
+
+ * Add retry counter for ``status_forcelist``. (Issue #1147)
+
+ * Added ``contrib`` module for using SecureTransport on macOS:
+ ``urllib3.contrib.securetransport``. (Pull #1122)
+
+ * urllib3 now only normalizes the case of ``http://`` and ``https://`` schemes:
+ for schemes it does not recognise, it assumes they are case-sensitive and
+ leaves them unchanged.
+ (Issue #1080)
+
+
+ 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)
-----------------
diff --git a/README.rst b/README.rst
index 7c7a338..0e4fdf2 100644
--- a/README.rst
+++ b/README.rst
@@ -1,13 +1,21 @@
urllib3
=======
-.. image:: https://travis-ci.org/shazow/urllib3.png?branch=master
+.. image:: https://travis-ci.org/shazow/urllib3.svg?branch=master
:alt: Build status on Travis
:target: https://travis-ci.org/shazow/urllib3
+.. image:: https://img.shields.io/appveyor/ci/shazow/urllib3/master.svg
+ :alt: Build status on AppVeyor
+ :target: https://ci.appveyor.com/project/shazow/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
diff --git a/dev-requirements.txt b/dev-requirements.txt
index 47af0d0..d241d9d 100644
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -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
diff --git a/docs/advanced-usage.rst b/docs/advanced-usage.rst
index f28c83c..e36726c 100644
--- a/docs/advanced-usage.rst
+++ b/docs/advanced-usage.rst
@@ -184,12 +184,6 @@ keychain then the connection will succeed.
`This article <https://hynek.me/articles/apple-openssl-verification-surprises/>`_
has more in-depth analysis and explanation.
-If you have `homebrew <http://brew.sh>`_, you can configure homebrew Python to
-use homebrew's OpenSSL instead of the system OpenSSL::
-
- brew install openssl
- brew install python --with-brewed-openssl
-
.. _ssl_warnings:
SSL Warnings
diff --git a/dummyserver/.DS_Store b/dummyserver/.DS_Store
new file mode 100644
index 0000000..5d0af4a
Binary files /dev/null and b/dummyserver/.DS_Store differ
diff --git a/dummyserver/certs/cacert.pem b/dummyserver/certs/cacert.pem
index 38d32dc..faba12f 100644
--- a/dummyserver/certs/cacert.pem
+++ b/dummyserver/certs/cacert.pem
@@ -1,23 +1,23 @@
-----BEGIN CERTIFICATE-----
MIIDzDCCAzWgAwIBAgIJALPrscov4b/jMA0GCSqGSIb3DQEBBQUAMIGBMQswCQYD
-VQQGEwJGSTEOMAwGA1UECBMFZHVtbXkxDjAMBgNVBAcTBWR1bW15MQ4wDAYDVQQK
-EwVkdW1teTEOMAwGA1UECxMFZHVtbXkxETAPBgNVBAMTCFNuYWtlT2lsMR8wHQYJ
+VQQGEwJGSTEOMAwGA1UECAwFZHVtbXkxDjAMBgNVBAcMBWR1bW15MQ4wDAYDVQQK
+DAVkdW1teTEOMAwGA1UECwwFZHVtbXkxETAPBgNVBAMMCFNuYWtlT2lsMR8wHQYJ
KoZIhvcNAQkBFhBkdW1teUB0ZXN0LmxvY2FsMB4XDTExMTIyMjA3NTYxNVoXDTIx
-MTIxOTA3NTYxNVowgYExCzAJBgNVBAYTAkZJMQ4wDAYDVQQIEwVkdW1teTEOMAwG
-A1UE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IBDQQeFhxUaW55Q0EgR2VuZXJhdGVkIENlcnRpZmljYXRlMA4G
-A1UdDwEB/wQEAwICBDANBgkqhkiG9w0BAQUFAAOBgQBnnwtO8onsyhGOvS6cS8af
-IRZyAXgouuPeP3Zrf5W80iZcV23u94969sPEIsD8Ujv5u0hUSrToGl4ahOMEOFNL
-R5ndQOkh3VsepJnoE+RklZzbHWxU8onWlVzsNBFbclxidzaU3UHmdgXJAJL5nVSd
-Zpn44QSS0UXsaC0mBimVNw==
+A1UdDwEB/wQEAwICBDANBgkqhkiG9w0BAQUFAAOBgQBvz3AlIM1x7CMmwkmhLV6+
+PJkMnPW7XbP+cDYUlddCk7XhIDY4486JxqZegMTWgbUt0AgXYfHLFsTqUJXrnLj2
+WqLb3KP2D1HvnvxJjdJV3M6+TP7tGiY4ICi0zff96FG5C2w9Avsozhr3xDFtjKBv
+gyA6UdP3oZGN93oOFiMJXg==
-----END CERTIFICATE-----
diff --git a/dummyserver/certs/server.combined.pem b/dummyserver/certs/server.combined.pem
new file mode 100644
index 0000000..96c8ce0
--- /dev/null
+++ b/dummyserver/certs/server.combined.pem
@@ -0,0 +1,36 @@
+-----BEGIN CERTIFICATE-----
+MIIDczCCAtygAwIBAgIBATANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UEBhMCRkkx
+DjAMBgNVBAgMBWR1bW15MQ4wDAYDVQQHDAVkdW1teTEOMAwGA1UECgwFZHVtbXkx
+DjAMBgNVBAsMBWR1bW15MREwDwYDVQQDDAhTbmFrZU9pbDEfMB0GCSqGSIb3DQEJ
+ARYQZHVtbXlAdGVzdC5sb2NhbDAeFw0xMTEyMjIwNzU4NDBaFw0yMTEyMTgwNzU4
+NDBaMGExCzAJBgNVBAYTAkZJMQ4wDAYDVQQIDAVkdW1teTEOMAwGA1UEBwwFZHVt
+bXkxDjAMBgNVBAoMBWR1bW15MQ4wDAYDVQQLDAVkdW1teTESMBAGA1UEAwwJbG9j
+YWxob3N0MIGfMA0GCSqGSIb3DQEBA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8+RQrdVg2tc9Fzo+yTnn30sF/rx8/AiCDOV4qdGAh
+HKjKKaGj2H/rotqoEFcxBy05LrgJXxydBP72e9PYhNgKOcSmCQu4yALIPEXfKuIM
+zgAErHVJ2l79fif3D4hzNyz+u5E1A9n3FG9cgaJSiYP8IG2RAkEA82GZ8rBkSGQQ
+ZQ3oFuzPAAL21lbj8D0p76fsCpvS7427DtZDOjhOIKZmaeykpv+qSzRraqEqjDRi
+S4kjQvwh6QJBAOKniZ+NDo2lSpbOFk+XlmABK1DormVpj8KebHEZYok1lRI+WiX9
+Nnoe9YLgix7++6H5SBBCcTB4HvM+5A4BuwMCQQChcX/eZbXP81iQwB3Rfzp8xnqY
+icDf7qKvz9Ma4myU7Y5E9EpaB1mD/P14jDpYcMW050vNyqTfpiwB8TFL0NZpAkEA
+02jkFH9UyMgZV6qo4tqI98l/ZrtyF8OrxSNSEPhVkZf6EQc5vN9/lc8Uv1vESEgb
+3AwRrKDcxRH2BHtv6qSwkwJAGjqnkIcEkA75r1e55/EF2chcZW1+tpwKupE8CtAH
+VXGd5DVwt4cYWkLUj2gF2fJbV97uu2MAg5CFDb+vQ6p5eA==
+-----END RSA PRIVATE KEY-----
diff --git a/dummyserver/handlers.py b/dummyserver/handlers.py
index bc6ad94..44f5cda 100644
--- a/dummyserver/handlers.py
+++ b/dummyserver/handlers.py
@@ -158,8 +158,12 @@ class TestingApp(RequestHandler):
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``"
diff --git a/dummyserver/server.py b/dummyserver/server.py
index 89001e2..29247a6 100755
--- a/dummyserver/server.py
+++ b/dummyserver/server.py
@@ -48,6 +48,7 @@ DEFAULT_CA_BAD = os.path.join(CERTS_PATH, 'client_bad.pem')
NO_SAN_CA = os.path.join(CERTS_PATH, 'cacert.no_san.pem')
DEFAULT_CA_DIR = os.path.join(CERTS_PATH, 'ca_path_test')
IPV6_ADDR_CA = os.path.join(CERTS_PATH, 'server.ipv6addr.crt')
+COMBINED_CERT_AND_KEY = os.path.join(CERTS_PATH, 'server.combined.pem')
def _has_ipv6(host):
@@ -120,7 +121,7 @@ class SocketServerThread(threading.Thread):
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()
@@ -210,7 +211,9 @@ def bind_sockets(port, address=None, family=socket.AF_UNSPEC, backlog=128,
def run_tornado_app(app, io_loop, certs, scheme, host):
- app.last_req = datetime.fromtimestamp(0)
+ # We can't use fromtimestamp(0) because of CPython issue 29097, so we'll
+ # just construct the datetime object directly.
+ app.last_req = datetime(1970, 1, 1)
if scheme == 'https':
http_server = tornado.httpserver.HTTPServer(app, ssl_options=certs,
diff --git a/dummyserver/testcase.py b/dummyserver/testcase.py
index e45fedf..88dfd69 100644
--- a/dummyserver/testcase.py
+++ b/dummyserver/testcase.py
@@ -1,4 +1,4 @@
-import unittest
+import sys
import socket
import threading
from nose.plugins.skip import SkipTest
@@ -13,6 +13,11 @@ from dummyserver.server import (
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'):
diff --git a/setup.cfg b/setup.cfg
index fbaace4..e585a59 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -5,7 +5,7 @@ cover-package = urllib3
cover-erase = true
[flake8]
-exclude = ./docs/conf.py,./test/*,./urllib3/packages/*
+exclude = ./docs/conf.py,./urllib3/packages/*
max-line-length = 99
[wheel]
@@ -26,5 +26,4 @@ requires-dist =
[egg_info]
tag_build =
tag_date = 0
-tag_svn_revision = 0
diff --git a/setup.py b/setup.py
index 93950e5..fbff594 100644
--- a/setup.py
+++ b/setup.py
@@ -42,7 +42,7 @@ setup(name='urllib3',
packages=['urllib3',
'urllib3.packages', 'urllib3.packages.ssl_match_hostname',
'urllib3.packages.backports', 'urllib3.contrib',
- 'urllib3.util',
+ 'urllib3.contrib._securetransport', 'urllib3.util',
],
requires=[],
tests_require=[
diff --git a/test/__init__.py b/test/__init__.py
index bab39ed..1983040 100644
--- a/test/__init__.py
+++ b/test/__init__.py
@@ -4,11 +4,13 @@ import errno
import functools
import logging
import socket
+import platform
from nose.plugins.skip import SkipTest
-from urllib3.exceptions import MaxRetryError, HTTPWarning
+from urllib3.exceptions import HTTPWarning
from urllib3.packages import six
+from urllib3.util import ssl_
# We need a host that will not immediately close the connection with a TCP
# Reset. SO suggests this hostname
@@ -29,10 +31,12 @@ def clear_warnings(cls=HTTPWarning):
new_filters.append(f)
warnings.filters[:] = new_filters
+
def setUp():
clear_warnings()
warnings.simplefilter('ignore', HTTPWarning)
+
def onlyPy26OrOlder(test):
"""Skips this test unless you are on Python2.6.x or earlier."""
@@ -44,6 +48,7 @@ def onlyPy26OrOlder(test):
return test(*args, **kwargs)
return wrapper
+
def onlyPy27OrNewer(test):
"""Skips this test unless you are on Python 2.7.x or later."""
@@ -55,6 +60,7 @@ def onlyPy27OrNewer(test):
return test(*args, **kwargs)
return wrapper
+
def onlyPy279OrNewer(test):
"""Skips this test unless you are on Python 2.7.9 or later."""
@@ -66,6 +72,7 @@ def onlyPy279OrNewer(test):
return test(*args, **kwargs)
return wrapper
+
def onlyPy2(test):
"""Skips this test unless you are on Python 2.x"""
@@ -77,6 +84,7 @@ def onlyPy2(test):
return test(*args, **kwargs)
return wrapper
+
def onlyPy3(test):
"""Skips this test unless you are on Python3.x"""
@@ -88,30 +96,66 @@ def onlyPy3(test):
return test(*args, **kwargs)
return wrapper
+
+def notSecureTransport(test):
+ """Skips this test when SecureTransport is in use."""
+
+ @functools.wraps(test)
+ def wrapper(*args, **kwargs):
+ msg = "{name} does not run with SecureTransport".format(name=test.__name__)
+ if ssl_.IS_SECURETRANSPORT:
+ raise SkipTest(msg)
+ return test(*args, **kwargs)
+ return wrapper
+
+
+def onlyPy27OrNewerOrNonWindows(test):
+ """Skips this test unless you are on Python2.7+ or non-Windows"""
+ @functools.wraps(test)
+ def wrapper(*args, **kwargs):
+ msg = "{name} requires Python2.7+ or non-Windows to run".format(name=test.__name__)
+ if sys.version_info < (2, 7) and platform.system() == 'Windows':
+ raise SkipTest(msg)
+ 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
+ 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
diff --git a/test/benchmark.py b/test/benchmark.py
index 242e72f..2b3ffe3 100644
--- a/test/benchmark.py
+++ b/test/benchmark.py
@@ -11,7 +11,7 @@ import time
import urllib
sys.path.append('../')
-import urllib3
+import urllib3 # noqa: E402
# URLs to download. Doesn't matter as long as they're from the same host, so we
@@ -39,7 +39,7 @@ def urllib_get(url_list):
assert url_list
for url in url_list:
now = time.time()
- r = urllib.urlopen(url)
+ urllib.urlopen(url)
elapsed = time.time() - now
print("Got in %0.3f: %s" % (elapsed, url))
@@ -49,7 +49,7 @@ def pool_get(url_list):
pool = urllib3.PoolManager()
for url in url_list:
now = time.time()
- r = pool.request('GET', url, assert_same_host=False)
+ pool.request('GET', url, assert_same_host=False)
elapsed = time.time() - now
print("Got in %0.3fs: %s" % (elapsed, url))
diff --git a/test/contrib/test_gae_manager.py b/test/contrib/test_gae_manager.py
index bcdf5fb..685c4ab 100644
--- a/test/contrib/test_gae_manager.py
+++ b/test/contrib/test_gae_manager.py
@@ -190,12 +190,13 @@ class TestGAERetry(TestRetry):
self.pool._absolute_url('/successful_retry'),
None, 418, None),))
- #test_max_retry = None
- #test_disabled_retry = None
+ # test_max_retry = None
+ # test_disabled_retry = None
# We don't need these tests because URLFetch resolves its own redirects.
test_retry_redirect_history = None
test_multi_redirect_history = None
+
class TestGAERetryAfter(TestRetryAfter):
__test__ = True
diff --git a/test/contrib/test_pyopenssl.py b/test/contrib/test_pyopenssl.py
index e88edde..4c1cf84 100644
--- a/test/contrib/test_pyopenssl.py
+++ b/test/contrib/test_pyopenssl.py
@@ -2,7 +2,6 @@
import unittest
from nose.plugins.skip import SkipTest
-from urllib3.packages import six
try:
from urllib3.contrib.pyopenssl import (inject_into_urllib3,
@@ -12,8 +11,10 @@ except ImportError as e:
raise SkipTest('Could not import PyOpenSSL: %r' % e)
-from ..with_dummyserver.test_https import TestHTTPS, TestHTTPS_TLSv1
-from ..with_dummyserver.test_socketlevel import TestSNI, TestSocketClosing
+from ..with_dummyserver.test_https import TestHTTPS, TestHTTPS_TLSv1 # noqa: F401
+from ..with_dummyserver.test_socketlevel import ( # noqa: F401
+ TestSNI, TestSocketClosing, TestClientCerts
+)
def setup_module():
diff --git a/test/contrib/test_pyopenssl_dependencies.py b/test/contrib/test_pyopenssl_dependencies.py
new file mode 100644
index 0000000..ad45e47
--- /dev/null
+++ b/test/contrib/test_pyopenssl_dependencies.py
@@ -0,0 +1,46 @@
+# -*- 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):
+ 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()
diff --git a/test/contrib/test_securetransport.py b/test/contrib/test_securetransport.py
new file mode 100644
index 0000000..96fc57e
--- /dev/null
+++ b/test/contrib/test_securetransport.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+from nose.plugins.skip import SkipTest
+
+try:
+ from urllib3.contrib.securetransport import (inject_into_urllib3,
+ extract_from_urllib3)
+except ImportError as e:
+ raise SkipTest('Could not import SecureTransport: %r' % e)
+
+from ..with_dummyserver.test_https import TestHTTPS, TestHTTPS_TLSv1 # noqa: F401
+from ..with_dummyserver.test_socketlevel import ( # noqa: F401
+ TestSNI, TestSocketClosing, TestClientCerts
+)
+
+
+def setup_module():
+ inject_into_urllib3()
+
+
+def teardown_module():
+ extract_from_urllib3()
diff --git a/test/contrib/test_socks.py b/test/contrib/test_socks.py
index 34b6c18..da55343 100644
--- a/test/contrib/test_socks.py
+++ b/test/contrib/test_socks.py
@@ -223,12 +223,44 @@ class TestSocks5Proxy(IPV4SocketDummyServerTestCase):
self._start_server(request_handler)
proxy_url = "socks5://%s:%s" % (self.host, self.port)
pm = socks.SOCKSProxyManager(proxy_url)
+ self.addCleanup(pm.clear)
response = pm.request('GET', 'http://16.17.18.19')
self.assertEqual(response.status, 200)
self.assertEqual(response.data, b'')
self.assertEqual(response.headers['Server'], 'SocksTestServer')
+ def test_local_dns(self):
+ def request_handler(listener):
+ sock = listener.accept()[0]
+
+ handler = handle_socks5_negotiation(sock, negotiate=False)
+ addr, port = next(handler)
+
+ self.assertIn(addr, ['127.0.0.1', '::1'])
+ self.assertTrue(port, 80)
+ handler.send(True)
+
+ while True:
+ buf = sock.recv(65535)
+ if buf.endswith(b'\r\n\r\n'):
+ break
+
+ sock.sendall(b'HTTP/1.1 200 OK\r\n'
+ b'Server: SocksTestServer\r\n'
+ b'Content-Length: 0\r\n'
+ b'\r\n')
+ sock.close()
+
+ self._start_server(request_handler)
+ proxy_url = "socks5://%s:%s" % (self.host, self.port)
+ pm = socks.SOCKSProxyManager(proxy_url)
+ response = pm.request('GET', 'http://localhost')
+
+ self.assertEqual(response.status, 200)
+ self.assertEqual(response.data, b'')
+ self.assertEqual(response.headers['Server'], 'SocksTestServer')
+
def test_correct_header_line(self):
def request_handler(listener):
sock = listener.accept()[0]
@@ -256,8 +288,9 @@ class TestSocks5Proxy(IPV4SocketDummyServerTestCase):
sock.close()
self._start_server(request_handler)
- proxy_url = "socks5://%s:%s" % (self.host, self.port)
+ proxy_url = "socks5h://%s:%s" % (self.host, self.port)
pm = socks.SOCKSProxyManager(proxy_url)
+ self.addCleanup(pm.clear)
response = pm.request('GET', 'http://example.com')
self.assertEqual(response.status, 200)
@@ -268,8 +301,9 @@ class TestSocks5Proxy(IPV4SocketDummyServerTestCase):
event.wait()
self._start_server(request_handler)
- proxy_url = "socks5://%s:%s" % (self.host, self.port)
+ proxy_url = "socks5h://%s:%s" % (self.host, self.port)
pm = socks.SOCKSProxyManager(proxy_url)
+ self.addCleanup(pm.clear)
self.assertRaises(
ConnectTimeoutError, pm.request, 'GET', 'http://example.com',
@@ -285,8 +319,9 @@ class TestSocks5Proxy(IPV4SocketDummyServerTestCase):
event.set()
self._start_server(request_handler)
- proxy_url = "socks5://%s:%s" % (self.host, self.port)
+ proxy_url = "socks5h://%s:%s" % (self.host, self.port)
pm = socks.SOCKSProxyManager(proxy_url)
+ self.addCleanup(pm.clear)
event.wait()
self.assertRaises(
@@ -308,8 +343,9 @@ class TestSocks5Proxy(IPV4SocketDummyServerTestCase):
sock.close()
self._start_server(request_handler)
- proxy_url = "socks5://%s:%s" % (self.host, self.port)
+ proxy_url = "socks5h://%s:%s" % (self.host, self.port)
pm = socks.SOCKSProxyManager(proxy_url)
+ self.addCleanup(pm.clear)
self.assertRaises(
NewConnectionError, pm.request, 'GET', 'http://example.com',
@@ -344,7 +380,9 @@ class TestSocks5Proxy(IPV4SocketDummyServerTestCase):
self._start_server(request_handler)
proxy_url = "socks5://%s:%s" % (self.host, self.port)
pm = socks.SOCKSProxyManager(proxy_url, username='user',
- password='pass')
+ password='pass')
+ self.addCleanup(pm.clear)
+
response = pm.request('GET', 'http://16.17.18.19')
self.assertEqual(response.status, 200)
@@ -361,9 +399,10 @@ class TestSocks5Proxy(IPV4SocketDummyServerTestCase):
next(handler)
self._start_server(request_handler)
- proxy_url = "socks5://%s:%s" % (self.host, self.port)
+ proxy_url = "socks5h://%s:%s" % (self.host, self.port)
pm = socks.SOCKSProxyManager(proxy_url, username='user',
- password='badpass')
+ password='badpass')
+ self.addCleanup(pm.clear)
try:
pm.request('GET', 'http://example.com', retries=False)
@@ -403,6 +442,7 @@ class TestSocks5Proxy(IPV4SocketDummyServerTestCase):
... 8296 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-urllib3.git
More information about the Python-modules-commits
mailing list