Projects
openEuler:Mainline
python-urllib3
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 10
View file
_service:tar_scm:python-urllib3.spec
Changed
@@ -2,8 +2,8 @@ %bcond_without tests Name: python-%{srcname} -Version: 1.26.12 -Release: 5 +Version: 1.26.16 +Release: 2 Summary: Sanity-friendly HTTP client for Python License: MIT URL: https://urllib3.readthedocs.io @@ -11,13 +11,6 @@ Source1: ssl_match_hostname_py3.py Patch0001: remove_mock.patch -Patch6000: backport-CVE-2021-28363.patch -Patch6001: backport-strip-leading-zeros-form-ports.patch -Patch6002: backport-fixed-issue-with-port-0-returning-None.patch -Patch6003: backport-Fix-socket-timeout-value-when-HTTPConnection-is-reused.patch -Patch6004: backport-Remove-Exclamation-mark-character-from-the-unreserved-characters.patch -Patch6005: backport-Fix-_idna_encode-handling-of-x80.patch -Patch6006: backport-fix-test_ssl_object_attributes.patch BuildArch: noarch @@ -83,6 +76,18 @@ %{python3_sitelib}/urllib3-*.egg-info %changelog +* Tue Aug 01 2023 chengyechun <chengyechun1@huawei.com> - 1.26.16-2 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:delete the unnecessary patch + +* Mon Jul 31 2023 chengyechun <chengyechun1@huawei.com> - 1.26.16-1 +- Type:enhancement +- CVE:NA +- SUG:NA +- DESC:update to 1.26.16 + * Tue Jul 25 2023 chengyechun <chengyechun1@huawei.com> - 1.26.12-5 - Type:bugfix - CVE:NA
View file
_service:tar_scm:backport-CVE-2021-28363.patch
Deleted
@@ -1,93 +0,0 @@ -From 8d65ea1ecf6e2cdc27d42124e587c1b83a3118b0 Mon Sep 17 00:00:00 2001 -From: Jorge <JALopezSilva@gmail.com> -Date: Mon, 15 Mar 2021 06:49:49 -0700 -Subject: PATCH Merge pull request from GHSA-5phf-pp7p-vc2r - -* Enable hostname verification for HTTPS proxies with default cert. - -Signed-off-by: Jorge Lopez Silva <jalopezsilva@gmail.com> - -* Adjust exception check for Python 3.9+ - -Signed-off-by: Jorge Lopez Silva <jalopezsilva@gmail.com> - -* Use a SAN instead of a common name. - -Signed-off-by: Jorge Lopez Silva <jalopezsilva@gmail.com> ---- - src/urllib3/connection.py | 4 ++++ - test/conftest.py | 11 ++++++++++ - .../test_proxy_poolmanager.py | 20 +++++++++++++++++++ - 3 files changed, 35 insertions(+) - -diff --git a/src/urllib3/connection.py b/src/urllib3/connection.py -index 60f70f7..f59f29b 100644 ---- a/src/urllib3/connection.py -+++ b/src/urllib3/connection.py -@@ -495,6 +495,10 @@ class HTTPSConnection(HTTPConnection): - self.ca_cert_dir, - self.ca_cert_data, - ) -+ # By default urllib3's SSLContext disables `check_hostname` and uses -+ # a custom check. For proxies we're good with relying on the default -+ # verification. -+ ssl_context.check_hostname = True - - # If no cert was provided, use only the default options for server - # certificate validation -diff --git a/test/conftest.py b/test/conftest.py -index 10c3a54..d4bbd97 100644 ---- a/test/conftest.py -+++ b/test/conftest.py -@@ -103,6 +103,17 @@ def no_san_server(tmp_path_factory): - yield cfg - - -+@pytest.fixture -+def no_localhost_san_server(tmp_path_factory): -+ tmpdir = tmp_path_factory.mktemp("certs") -+ ca = trustme.CA() -+ # non localhost common name -+ server_cert = ca.issue_cert(u"example.com") -+ -+ with run_server_in_thread("https", "localhost", tmpdir, ca, server_cert) as cfg: -+ yield cfg -+ -+ - @pytest.fixture - def no_san_proxy(tmp_path_factory): - tmpdir = tmp_path_factory.mktemp("certs") -diff --git a/test/with_dummyserver/test_proxy_poolmanager.py b/test/with_dummyserver/test_proxy_poolmanager.py -index d5e91a0..0f8df60 100644 ---- a/test/with_dummyserver/test_proxy_poolmanager.py -+++ b/test/with_dummyserver/test_proxy_poolmanager.py -@@ -565,6 +565,26 @@ class TestIPv6HTTPProxyManager(IPv6HTTPDummyProxyTestCase): - r = http.request("GET", "%s/" % self.https_url) - assert r.status == 200 - -+class TestHTTPSProxyVerification: -+ @onlyPy3 -+ def test_https_proxy_hostname_verification(self, no_localhost_san_server): -+ bad_server = no_localhost_san_server -+ bad_proxy_url = "https://%s:%s" % (bad_server.host, bad_server.port) -+ -+ # An exception will be raised before we contact the destination domain. -+ test_url = "testing.com" -+ with proxy_from_url(bad_proxy_url, ca_certs=bad_server.ca_certs) as https: -+ with pytest.raises(MaxRetryError) as e: -+ https.request("GET", "http://%s/" % test_url) -+ assert isinstance(e.value.reason, SSLError) -+ assert "hostname 'localhost' doesn't match" in str(e.value.reason) -+ -+ with pytest.raises(MaxRetryError) as e: -+ https.request("GET", "https://%s/" % test_url) -+ assert isinstance(e.value.reason, SSLError) -+ assert "hostname 'localhost' doesn't match" in str( -+ e.value.reason -+ ) or "Hostname mismatch" in str(e.value.reason) - - class TestHTTPSProxyVerification: - @onlyPy3 --- -2.27.0 -
View file
_service:tar_scm:backport-Fix-_idna_encode-handling-of-x80.patch
Deleted
@@ -1,29 +0,0 @@ -From a06c05cd4bba292ee26e3e9116cff902e0440b52 Mon Sep 17 00:00:00 2001 -From: Ben Kallus <49924171+kenballus@users.noreply.github.com> -Date: Wed, 8 Feb 2023 15:19:07 +0000 -Subject: PATCH Fix _idna_encode handling of '\x80' - -Co-authored-by: Illia Volochii <illia.volochii@gmail.com> - -Conflict:1.The content of "@@" is adapted 2.The line number is adapted -Reference:https://github.com/urllib3/urllib3/commit/a06c05cd4bba292ee26e3e9116cff902e0440b52 ---- - src/urllib3/util/url.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/urllib3/util/url.py b/src/urllib3/util/url.py -index 63166e8..8bac93a 100644 ---- a/src/urllib3/util/url.py -+++ b/src/urllib3/util/url.py -@@ -300,7 +300,7 @@ def _normalize_host(host, scheme): - - - def _idna_encode(name): -- if name and any(ord(x) > 128 for x in name): -+ if name and any(ord(x) >= 128 for x in name): - try: - import idna - except ImportError: --- -2.27.0 - \ No newline at end of file
View file
_service:tar_scm:backport-Fix-socket-timeout-value-when-HTTPConnection-is-reused.patch
Deleted
@@ -1,75 +0,0 @@ -From a7ce8e0881c94800b14687145ee11940246d2b22 Mon Sep 17 00:00:00 2001 -From: Nick Williams <68963309+nickwilliams-zaxiom@users.noreply.github.com> -Date: Fri, 20 Jan 2023 07:59:33 -0600 -Subject: PATCH 1.26 Fix socket timeout value when HTTPConnection is reused - -Co-authored-by: Seth Michael Larson <sethmichaellarson@gmail.com> -Co-authored-by: Quentin Pradet <quentin.pradet@gmail.com> - -Conflict:1.The content of "@@" is adapted 2.The line number is adapted 3. no add testcode -Reference:https://github.com/urllib3/urllib3/commit/a7ce8e0881c94800b14687145ee11940246d2b22 ---- - src/urllib3/connection.py | 5 +++++ - src/urllib3/connectionpool.py | 2 +- - src/urllib3/util/timeout.py | 9 ++++++--- - 3 files changed, 12 insertions(+), 4 deletions(-) - -diff --git a/src/urllib3/connection.py b/src/urllib3/connection.py -index f48daea..f121511 100644 ---- a/src/urllib3/connection.py -+++ b/src/urllib3/connection.py -@@ -229,6 +229,11 @@ class HTTPConnection(_HTTPConnection, object): - ) - - def request(self, method, url, body=None, headers=None): -+ # Update the inner socket's timeout value to send the request. -+ # This only triggers if the connection is re-used. -+ if getattr(self, "sock", None) is not None: -+ self.sock.settimeout(self.timeout) -+ - if headers is None: - headers = {} - else: -diff --git a/src/urllib3/connectionpool.py b/src/urllib3/connectionpool.py -index 8dccf4b..e528019 100644 ---- a/src/urllib3/connectionpool.py -+++ b/src/urllib3/connectionpool.py -@@ -375,7 +375,7 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods): - - timeout_obj = self._get_timeout(timeout) - timeout_obj.start_connect() -- conn.timeout = timeout_obj.connect_timeout -+ conn.timeout = Timeout.resolve_default_timeout(timeout_obj.connect_timeout) - - # Trigger any extra validation we need to do. - try: -diff --git a/src/urllib3/util/timeout.py b/src/urllib3/util/timeout.py -index ff69593..78e18a6 100644 ---- a/src/urllib3/util/timeout.py -+++ b/src/urllib3/util/timeout.py -@@ -2,9 +2,8 @@ from __future__ import absolute_import - - import time - --# The default socket timeout, used by httplib to indicate that no timeout was --# specified by the user --from socket import _GLOBAL_DEFAULT_TIMEOUT -+# The default socket timeout, used by httplib to indicate that no timeout was; specified by the user -+from socket import _GLOBAL_DEFAULT_TIMEOUT, getdefaulttimeout - - from ..exceptions import TimeoutStateError - -@@ -116,6 +115,10 @@ class Timeout(object): - # __str__ provided for backwards compatibility - __str__ = __repr__ - -+ @classmethod -+ def resolve_default_timeout(cls, timeout): -+ return getdefaulttimeout() if timeout is cls.DEFAULT_TIMEOUT else timeout -+ - @classmethod - def _validate_timeout(cls, value, name): - """Check that a timeout attribute is valid. --- -2.27.0 - \ No newline at end of file
View file
_service:tar_scm:backport-Remove-Exclamation-mark-character-from-the-unreserved-characters.patch
Deleted
@@ -1,27 +0,0 @@ -From 27370204dbcb2ee555a136948afee276a96ddc87 Mon Sep 17 00:00:00 2001 -From: Ben Kallus <49924171+kenballus@users.noreply.github.com> -Date: Fri, 3 Feb 2023 08:38:04 -0500 -Subject: PATCH 1.26 Remove "!" character from the "unreserved" characters - in IPv6 Zone ID parsing - -Conflict:The content of "index" and "@@" are adapted -Reference:https://github.com/urllib3/urllib3/commit/27370204dbcb2ee555a136948afee276a96ddc87 ---- - src/urllib3/util/url.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/urllib3/util/url.py b/src/urllib3/util/url.py -index 63166e8..33dfb45 100644 ---- a/src/urllib3/util/url.py -+++ b/src/urllib3/util/url.py -@@ -50,7 +50,7 @@ _variations = - "(?:(?:%(hex)s:){0,6}%(hex)s)?::", - - --UNRESERVED_PAT = r"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._!\-~" -+UNRESERVED_PAT = r"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._\-~" - IPV6_PAT = "(?:" + "|".join(x % _subs for x in _variations) + ")" - ZONE_ID_PAT = "(?:%25|%)(?:" + UNRESERVED_PAT + "|%a-fA-F0-9{2})+" - IPV6_ADDRZ_PAT = r"\" + IPV6_PAT + r"(?:" + ZONE_ID_PAT + r")?\" --- -2.27.0
View file
_service:tar_scm:backport-fix-test_ssl_object_attributes.patch
Deleted
@@ -1,33 +0,0 @@ -From 25cca389496b86ee809c21e5b641aeaa74809263 Mon Sep 17 00:00:00 2001 -From: Seth Michael Larson <sethmichaellarson@gmail.com> -Date: Tue, 25 Apr 2023 02:10:00 AM GMT+0800 -Subject: PATCH fix test_ssl_object_attributes - -Conflict:NA -Reference:https://github.com/urllib3/urllib3/commit/25cca389496b86ee809c21e5b641aeaa74809263 - ---- - test/test_ssltransport.py | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/test/test_ssltransport.py b/test/test_ssltransport.py -index e8d779f..809e053 100644 ---- a/test/test_ssltransport.py -+++ b/test/test_ssltransport.py -@@ -205,8 +205,11 @@ class SingleTLSLayerTestCase(SocketDummyServerTestCase): - assert ssock.selected_npn_protocol() is None - - shared_ciphers = ssock.shared_ciphers() -- assert type(shared_ciphers) == list -- assert len(shared_ciphers) > 0 -+ # SSLContext.shared_ciphers() changed behavior completely in a patch version. -+ # See: https://github.com/python/cpython/issues/96931 -+ assert shared_ciphers is None or ( -+ type(shared_ciphers) is list and len(shared_ciphers) > 0 -+ ) - - assert ssock.compression() is None - --- -2.23.0 -
View file
_service:tar_scm:backport-fixed-issue-with-port-0-returning-None.patch
Deleted
@@ -1,48 +0,0 @@ -From 25fbd5fb72ae8790cff9512878d302120e387e64 Mon Sep 17 00:00:00 2001 -From: Anil Khatri <anilkhatri.dev@gmail.com> -Date: Sat, 31 Dec 2022 01:38:50 +0530 -Subject: PATCH Fixed issue with port "0" returning None - -Conflict:adapt: -1.The content of "@@" is adapted -2.The line number is adapted -Reference:https://github.com/urllib3/urllib3/pull/2864 - ---- - src/urllib3/util/url.py | 2 +- - test/test_util.py | 7 +++++++ - 2 files changed, 8 insertions(+), 1 deletion(-) - -diff --git a/src/urllib3/util/url.py b/src/urllib3/util/url.py -index 8964cef..63166e8 100644 ---- a/src/urllib3/util/url.py -+++ b/src/urllib3/util/url.py -@@ -63,7 +63,7 @@ IPV6_ADDRZ_RE = re.compile("^" + IPV6_ADDRZ_PAT + "$") - BRACELESS_IPV6_ADDRZ_RE = re.compile("^" + IPV6_ADDRZ_PAT2:-2 + "$") - ZONE_ID_RE = re.compile("(" + ZONE_ID_PAT + r")\$") - --_HOST_PORT_PAT = ("^(%s|%s|%s)(?::0*(0-9{0,5}))?$") % ( -+_HOST_PORT_PAT = ("^(%s|%s|%s)(?::0*?(|0|1-90-9{0,4}))?$") % ( - REG_NAME_PAT, - IPV4_PAT, - IPV6_ADDRZ_PAT, -diff --git a/test/test_util.py b/test/test_util.py -index f6c8b43..7d512f5 100644 ---- a/test/test_util.py -+++ b/test/test_util.py -@@ -347,6 +347,13 @@ class TestUtil(object): - url = parse_url("https://example.com:0000000000080") - assert url.port == 80 - -+ def test_parse_url_only_zeros(self): -+ url = parse_url("https://example.com:0") -+ assert url.port == 0 -+ -+ url = parse_url("https://example.com:000000000000") -+ assert url.port == 0 -+ - def test_Url_str(self): - U = Url("http", host="google.com") - assert str(U) == U.url --- -2.27.0
View file
_service:tar_scm:backport-strip-leading-zeros-form-ports.patch
Deleted
@@ -1,45 +0,0 @@ -From 955da4d03eaa6785aef40a34f440a67d736a4793 Mon Sep 17 00:00:00 2001 -From: Seth Michael Larson <sethmichaellarson@gmail.com> -Date: Tue, 22 Nov 2022 17:59:57 +0000 -Subject: PATCH 1.26 Strip leading zeros from ports - -Co-authored-by: Bastian Venthur <bastian.venthur@flixbus.com> -Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com> - -Conflict:NA -Reference:https://github.com/urllib3/urllib3/commit/955da4d03eaa6785aef40a34f440a67d736a4793 ---- - src/urllib3/util/url.py | 2 +- - test/test_util.py | 4 ++++ - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/src/urllib3/util/url.py b/src/urllib3/util/url.py -index 81a03da..8964cef 100644 ---- a/src/urllib3/util/url.py -+++ b/src/urllib3/util/url.py -@@ -63,7 +63,7 @@ IPV6_ADDRZ_RE = re.compile("^" + IPV6_ADDRZ_PAT + "$") - BRACELESS_IPV6_ADDRZ_RE = re.compile("^" + IPV6_ADDRZ_PAT2:-2 + "$") - ZONE_ID_RE = re.compile("(" + ZONE_ID_PAT + r")\$") - --_HOST_PORT_PAT = ("^(%s|%s|%s)(?::(0-9{0,5}))?$") % ( -+_HOST_PORT_PAT = ("^(%s|%s|%s)(?::0*(0-9{0,5}))?$") % ( - REG_NAME_PAT, - IPV4_PAT, - IPV6_ADDRZ_PAT, -diff --git a/test/test_util.py b/test/test_util.py -index 562c106..f6c8b43 100644 ---- a/test/test_util.py -+++ b/test/test_util.py -@@ -343,6 +343,10 @@ class TestUtil(object): - with pytest.raises(LocationParseError): - parse_url("https://www.google.com:-80/") - -+ def test_parse_url_remove_leading_zeros(self): -+ url = parse_url("https://example.com:0000000000080") -+ assert url.port == 80 -+ - def test_Url_str(self): - U = Url("http", host="google.com") - assert str(U) == U.url --- -2.27.0
View file
_service:tar_scm:1.26.12.tar.gz/.coveragerc
Deleted
@@ -1,29 +0,0 @@ -run -source = - urllib3 - -omit = - *urllib3/packages/* - *urllib3/contrib/appengine.py - *urllib3/contrib/ntlmpool.py - *urllib3/contrib/pyopenssl.py - *urllib3/contrib/securetransport.py - *urllib3/contrib/_securetransport/* - -paths -source = - src/urllib3 - */urllib3 - *\urllib3 - -report -exclude_lines = - except ModuleNotFoundError: - except ImportError: - pass - import - raise - .* # Platform-specific.* - .*:.* # Python \d.* - .* # Abstract - .* # Defensive:
View file
_service:tar_scm:1.26.12.tar.gz/.github
Deleted
-(directory)
View file
_service:tar_scm:1.26.12.tar.gz/.github/CODEOWNERS
Deleted
@@ -1,9 +0,0 @@ -# Restrict all files related to deploying to -# require lead maintainer approval. - -.github/workflows/ @sethmlarson @pquentin @shazow -.github/CODEOWNERS @sethmlarson @pquentin @shazow -src/urllib3/_version.py @sethmlarson @pquentin @shazow -setup.py @sethmlarson @pquentin @shazow -pyproject.toml @sethmlarson @pquentin @shazow -ci/ @sethmlarson @pquentin @shazow
View file
_service:tar_scm:1.26.12.tar.gz/.github/FUNDING.yml
Deleted
@@ -1,3 +0,0 @@ -tidelift: pypi/urllib3 -open_collective: urllib3 -custom: https://gitcoin.co/grants/65/urllib3
View file
_service:tar_scm:1.26.12.tar.gz/.github/ISSUE_TEMPLATE
Deleted
-(directory)
View file
_service:tar_scm:1.26.12.tar.gz/.github/ISSUE_TEMPLATE/01_feature_request.md
Deleted
@@ -1,26 +0,0 @@ ---- -name: 🎁 Feature Request -about: Suggest a new feature ---- - -### Context - -What are you trying to do? -How do you expect to do it? -Is it something you currently cannot do? -Is this related to an existing issue/problem? - -### Alternatives - -Can you achieve the same result doing it in an alternative way? -Is the alternative considerable? - -### Duplicate - -Has the feature been requested before? -If so, please provide a link to the issue. - -### Contribution - -Would you be willing to submit a PR? -_(Help can be provided if you need assistance submitting a PR)_
View file
_service:tar_scm:1.26.12.tar.gz/.github/ISSUE_TEMPLATE/02_bug_report.md
Deleted
@@ -1,35 +0,0 @@ ---- -name: 🐞 Bug Report -about: Something is broken ---- - -### Subject - -Describe the issue here. - -### Environment - -Describe your environment. -At least, paste here the output of: - -```python -import platform -import urllib3 - -print("OS", platform.platform()) -print("Python", platform.python_version()) -print("urllib3", urllib3.__version__) -``` - -### Steps to Reproduce - -A simple and isolated way to reproduce the issue. A code snippet would be great. - -### Expected Behavior - -What should happen. - -### Actual Behavior - -What happens instead. -You may attach logs, packet captures, etc.
View file
_service:tar_scm:1.26.12.tar.gz/.github/ISSUE_TEMPLATE/config.yml
Deleted
@@ -1,11 +0,0 @@ -blank_issues_enabled: false -contact_links: - - name: 📚 Documentation - url: https://urllib3.readthedocs.io/en/latest/ - about: Make sure you read the relevant docs - - name: ❓ Ask on StackOverflow - url: https://stackoverflow.com/questions/tagged/urllib3 - about: Ask questions about usage in StackOverflow - - name: 💬 Ask the Community - url: https://discord.gg/CHEgCZN - about: Join urllib3's Discord server
View file
_service:tar_scm:1.26.12.tar.gz/.github/PULL_REQUEST_TEMPLATE.md
Deleted
@@ -1,8 +0,0 @@ -<!--- -Thanks for your contribution! ♥️ - -If this is your first PR to urllib3 please review the Contributing Guide: -https://urllib3.readthedocs.io/en/latest/contributing.html - -Adhering to the Contributing Guide means we can review, merge, and release your change faster! :) ---->
View file
_service:tar_scm:1.26.12.tar.gz/.github/workflows
Deleted
-(directory)
View file
_service:tar_scm:1.26.12.tar.gz/.github/workflows/ci.yml
Deleted
@@ -1,129 +0,0 @@ -name: CI - -on: push, pull_request - -permissions: "read-all" - -defaults: - run: - shell: bash - -jobs: - package: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - name: Set up Python 3.7 - uses: actions/setup-python@v2 - with: - python-version: "3.7" - - name: Check packages - run: | - python3.7 -m pip install pip setuptools wheel twine rstcheck; - python3.7 setup.py sdist bdist_wheel; - rstcheck README.rst CHANGES.rst - python3.7 -m twine check dist/* - test: - env: - SETUPTOOLS_USE_DISTUTILS: stdlib - strategy: - fail-fast: false - matrix: - python-version: "2.7", "3.6", "3.7", "3.8", "3.9", "3.10" - os: macos-latest, windows-latest, ubuntu-latest - experimental: false - nox-session: '' - include: - - python-version: "pypy3" - os: ubuntu-latest - experimental: false - nox-session: test-pypy - - python-version: "pypy2" - os: ubuntu-latest - experimental: false - nox-session: test-pypy - - python-version: "2.7" - os: ubuntu-latest - experimental: false - nox-session: google_brotli-2 - - python-version: "3.9" - os: ubuntu-latest - experimental: false - nox-session: google_brotli-3 - - python-version: "2.7" - os: ubuntu-latest - experimental: false - nox-session: app_engine - - python-version: 3.11-dev - os: ubuntu-latest - experimental: true - nox-session: test-3.11 - - runs-on: ${{ matrix.os }} - name: ${{ fromJson('{"macos-latest":"macOS","windows-latest":"Windows","ubuntu-latest":"Ubuntu"}')matrix.os }} ${{ matrix.python-version }} ${{ matrix.nox-session}} - continue-on-error: ${{ matrix.experimental }} - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Set Up Python - ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Set Up Python 3 to run nox - if: matrix.python-version != '3.7' - uses: actions/setup-python@v2 - with: - python-version: "3" - - - name: Install Dependencies - run: python -m pip install --upgrade pip setuptools nox - - - name: Run Tests - run: ./ci/run_tests.sh - env: - PYTHON_VERSION: ${{ matrix.python-version }} - NOX_SESSION: ${{ matrix.nox-session }} - - - name: Upload Coverage - if: ${{ matrix.nox-session != 'unsupported_python2' }} - uses: "actions/upload-artifact@v2" - with: - name: coverage-data - path: ".coverage.*" - if-no-files-found: error - - - coverage: - runs-on: "ubuntu-latest" - needs: test - steps: - - uses: actions/checkout@v2 - - name: "Use latest Python so it understands all syntax" - uses: actions/setup-python@v2 - with: - python-version: "3.10" - - - name: "Install coverage" - run: "python -m pip install --upgrade coverage" - - - name: "Download coverage data" - uses: actions/download-artifact@v2 - with: - name: coverage-data - - - name: "Combine & check coverage" - run: | - python -m coverage combine - python -m coverage html --skip-covered --skip-empty - python -m coverage report --ignore-errors --show-missing --fail-under=100 - - - name: "Upload report if check failed" - uses: actions/upload-artifact@v2 - with: - name: coverage-report - path: htmlcov - if: ${{ failure() }}
View file
_service:tar_scm:1.26.12.tar.gz/.github/workflows/integration.yml
Deleted
@@ -1,32 +0,0 @@ -name: Downstream - -on: - pull_request: - paths: - - "src/urllib3/_version.py" - -permissions: "read-all" - -jobs: - integration: - strategy: - fail-fast: false - matrix: - python-version: "3.10" - downstream: botocore, requests - - runs-on: ubuntu-18.04 - - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Set Up Python - ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install Dependencies - run: python -m pip install --upgrade nox - - name: Run downstream tests - run: nox -s downstream_${{ matrix.downstream }}-${{ matrix.python-version }}
View file
_service:tar_scm:1.26.12.tar.gz/.github/workflows/lint.yml
Deleted
@@ -1,20 +0,0 @@ -name: lint - -on: push, pull_request - -permissions: "read-all" - -jobs: - lint: - runs-on: ubuntu-20.04 - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Set up Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: "3.8" - - name: Lint the code - uses: pre-commit/action@v2.0.0 -
View file
_service:tar_scm:1.26.12.tar.gz/.github/workflows/publish.yml
Deleted
@@ -1,87 +0,0 @@ -name: Publish to PyPI - -on: - push: - tags: - - "*" - -permissions: - contents: "read" - # Needed to access the workflow's OIDC identity. - id-token: "write" - -jobs: - build: - name: "Build dists" - runs-on: "ubuntu-latest" - environment: - name: "publish" - outputs: - hashes: ${{ steps.hash.outputs.hashes }} - - steps: - - name: "Checkout repository" - uses: "actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b" - - - name: "Setup Python" - uses: "actions/setup-python@b55428b1882923874294fa556849718a1d7f2ca5" - with: - python-version: "3.x" - - - name: "Install dependencies" - run: python -m pip install build==0.8.0 - - - name: "Build dists" - run: | - SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) \ - python -m build - - - name: "Generate hashes" - id: hash - run: | - cd dist && echo "::set-output name=hashes::$(sha256sum * | base64 -w0)" - - - name: "Upload dists" - uses: "actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8" - with: - name: "dist" - path: "dist/" - if-no-files-found: error - retention-days: 5 - - provenance: - needs: build - permissions: - actions: read - contents: write - id-token: write - uses: "slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.2.0" - with: - base64-subjects: "${{ needs.build.outputs.hashes }}" - attestation-name: "urllib3.intoto.jsonl" - upload-assets: true - - publish: - name: "Publish" - if: startsWith(github.ref, 'refs/tags/') - needs: "build", "provenance" - runs-on: "ubuntu-latest" - - steps: - - name: "Download dists" - uses: "actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741" - with: - name: "dist" - path: "dist/" - - - name: "Upload dists to GitHub Release" - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - run: | - gh release upload ${{ github.ref_name }} dist/* --repo ${{ github.repository }} - - - name: "Publish dists to PyPI" - uses: "pypa/gh-action-pypi-publish@37f50c210e3d2f9450da2cd423303d6a14a6e29f" - with: - user: __token__ - password: ${{ secrets.PYPI_TOKEN }}
View file
_service:tar_scm:1.26.12.tar.gz/.gitignore
Deleted
@@ -1,10 +0,0 @@ -.* -!/.github/ -*.pyco -*.egg -*.egg-info -*.log -/dist -/build -/docs/_build -coverage.xml
View file
_service:tar_scm:1.26.12.tar.gz/.pre-commit-config.yaml
Deleted
@@ -1,18 +0,0 @@ -repos: - - repo: https://github.com/psf/black - rev: 21.12b0 - hooks: - - id: black - additional_dependencies: '.python2', 'click==8.0.4' - args: "--target-version", "py27" - - - repo: https://github.com/PyCQA/isort - rev: 5.9.3 - hooks: - - id: isort - - - repo: https://github.com/pycqa/flake8 - rev: 3.9.2 - hooks: - - id: flake8 - additional_dependencies: flake8-2020
View file
_service:tar_scm:1.26.12.tar.gz/.readthedocs.yml
Deleted
@@ -1,14 +0,0 @@ -version: 2 - -python: - install: - - method: pip - path: . - extra_requirements: - - brotli - - secure - - socks - - requirements: docs/requirements.txt - -sphinx: - fail_on_warning: true
View file
_service:tar_scm:1.26.12.tar.gz/CODE_OF_CONDUCT.md
Deleted
@@ -1,128 +0,0 @@ - -# Contributor Covenant Code of Conduct - -## Our Pledge - -We as members, contributors, and leaders pledge to make participation in our -community a harassment-free experience for everyone, regardless of age, body -size, visible or invisible disability, ethnicity, sex characteristics, gender -identity and expression, level of experience, education, socio-economic status, -nationality, personal appearance, race, religion, or sexual identity -and orientation. - -We pledge to act and interact in ways that contribute to an open, welcoming, -diverse, inclusive, and healthy community. - -## Our Standards - -Examples of behavior that contributes to a positive environment for our -community include: - -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, - and learning from the experience -* Focusing on what is best not just for us as individuals, but for the - overall community - -Examples of unacceptable behavior include: - -* The use of sexualized language or imagery, and sexual attention or - advances of any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email - address, without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Enforcement Responsibilities - -Community leaders are responsible for clarifying and enforcing our standards of -acceptable behavior and will take appropriate and fair corrective action in -response to any behavior that they deem inappropriate, threatening, offensive, -or harmful. - -Community leaders have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions that are -not aligned to this Code of Conduct, and will communicate reasons for moderation -decisions when appropriate. - -## Scope - -This Code of Conduct applies within all community spaces, and also applies when -an individual is officially representing the community in public spaces. -Examples of representing our community include using an official e-mail address, -posting via an official social media account, or acting as an appointed -representative at an online or offline event. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported to the community leaders responsible for enforcement at @sethmlarson or @shazow. -All complaints will be reviewed and investigated promptly and fairly. - -All community leaders are obligated to respect the privacy and security of the -reporter of any incident. - -## Enforcement Guidelines - -Community leaders will follow these Community Impact Guidelines in determining -the consequences for any action they deem in violation of this Code of Conduct: - -### 1. Correction - -**Community Impact**: Use of inappropriate language or other behavior deemed -unprofessional or unwelcome in the community. - -**Consequence**: A private, written warning from community leaders, providing -clarity around the nature of the violation and an explanation of why the -behavior was inappropriate. A public apology may be requested. - -### 2. Warning - -**Community Impact**: A violation through a single incident or series -of actions. - -**Consequence**: A warning with consequences for continued behavior. No -interaction with the people involved, including unsolicited interaction with -those enforcing the Code of Conduct, for a specified period of time. This -includes avoiding interactions in community spaces as well as external channels -like social media. Violating these terms may lead to a temporary or -permanent ban. - -### 3. Temporary Ban - -**Community Impact**: A serious violation of community standards, including -sustained inappropriate behavior. - -**Consequence**: A temporary ban from any sort of interaction or public -communication with the community for a specified period of time. No public or -private interaction with the people involved, including unsolicited interaction -with those enforcing the Code of Conduct, is allowed during this period. -Violating these terms may lead to a permanent ban. - -### 4. Permanent Ban - -**Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an -individual, or aggression toward or disparagement of classes of individuals. - -**Consequence**: A permanent ban from any sort of public interaction within -the community. - -## Attribution - -This Code of Conduct is adapted from the Contributor Covenanthomepage, -version 2.0, available at -https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. - -Community Impact Guidelines were inspired by Mozilla's code of conduct -enforcement ladder(https://github.com/mozilla/diversity). - -homepage: https://www.contributor-covenant.org - -For answers to common questions about this code of conduct, see the FAQ at -https://www.contributor-covenant.org/faq. Translations are available at -https://www.contributor-covenant.org/translations.
View file
_service:tar_scm:1.26.12.tar.gz/ci
Deleted
-(directory)
View file
_service:tar_scm:1.26.12.tar.gz/ci/deploy.sh
Deleted
@@ -1,7 +0,0 @@ -#!/bin/bash - -set -exo pipefail - -python3 -m pip install --upgrade twine wheel -python3 setup.py sdist bdist_wheel -python3 -m twine upload dist/* -u $PYPI_USERNAME -p $PYPI_PASSWORD --skip-existing
View file
_service:tar_scm:1.26.12.tar.gz/ci/run_tests.sh
Deleted
@@ -1,14 +0,0 @@ -#!/bin/bash - - -if "${NOX_SESSION}" == "app_engine" ; then - export GAE_SDK_PATH=$HOME/.cache/google_appengine - python2 -m pip install gcp-devrel-py-tools==0.0.16 - gcp-devrel-py-tools download-appengine-sdk "$(dirname ${GAE_SDK_PATH})" -fi - -if -z "$NOX_SESSION" ; then - cat /etc/hosts - NOX_SESSION=test-${PYTHON_VERSION%-dev} -fi -nox -s $NOX_SESSION --error-on-missing-interpreters
View file
_service:tar_scm:1.26.12.tar.gz/codecov.yml
Deleted
@@ -1,8 +0,0 @@ -coverage: - status: - patch: - default: - target: '100' - project: - default: - target: '100'
View file
_service:tar_scm:1.26.12.tar.gz/noxfile.py
Deleted
@@ -1,153 +0,0 @@ -import os -import shutil -import subprocess - -import nox - -SOURCE_FILES = - "docs/", - "dummyserver/", - "src/", - "test/", - "noxfile.py", - "setup.py", - - - -def tests_impl(session, extras="socks,secure,brotli"): - # Install deps and the package itself. - session.install("-r", "dev-requirements.txt") - session.install(".{extras}".format(extras=extras)) - - # Show the pip version. - session.run("pip", "--version") - # Print the Python version and bytesize. - session.run("python", "--version") - session.run("python", "-c", "import struct; print(struct.calcsize('P') * 8)") - # Print OpenSSL information. - session.run("python", "-m", "OpenSSL.debug") - - # Inspired from https://hynek.me/articles/ditch-codecov-python/ - # We use parallel mode and then combine in a later CI step - session.run( - "coverage", - "run", - "--parallel-mode", - "-m", - "pytest", - "-r", - "a", - f"--color={'yes' if 'GITHUB_ACTIONS' in os.environ else 'auto'}", - "--tb=native", - "--no-success-flaky-report", - *(session.posargs or ("test/",)), - env={"PYTHONWARNINGS": "always::DeprecationWarning"}, - ) - - -@nox.session(python="2.7", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "pypy") -def test(session): - tests_impl(session) - - -@nox.session(python="2", "3") -def google_brotli(session): - # https://pypi.org/project/Brotli/ is the Google version of brotli, so - # install it separately and don't install our brotli extra (which installs - # brotlipy). - session.install("brotli") - tests_impl(session, extras="socks,secure") - - -@nox.session(python="2.7") -def app_engine(session): - session.install("-r", "dev-requirements.txt") - session.install(".") - session.run( - "coverage", - "run", - "--parallel-mode", - "-m", - "pytest", - "-r", - "sx", - "test/appengine", - *session.posargs, - ) - - -def git_clone(session, git_url): - session.run("git", "clone", "--depth", "1", git_url, external=True) - - -@nox.session(python="3.10") -def downstream_botocore(session): - root = os.getcwd() - tmp_dir = session.create_tmp() - - session.cd(tmp_dir) - git_clone(session, "https://github.com/boto/botocore") - session.chdir("botocore") - session.run("git", "rev-parse", "HEAD", external=True) - session.run("python", "scripts/ci/install") - - session.cd(root) - session.install(".", silent=False) - session.cd(f"{tmp_dir}/botocore") - - session.run("python", "scripts/ci/run-tests") - - -@nox.session(python="3.10") -def downstream_requests(session): - root = os.getcwd() - tmp_dir = session.create_tmp() - - session.cd(tmp_dir) - git_clone(session, "https://github.com/psf/requests") - session.chdir("requests") - session.run("git", "rev-parse", "HEAD", external=True) - session.install(".socks", silent=False) - session.install("-r", "requirements-dev.txt", silent=False) - - session.cd(root) - session.install(".", silent=False) - session.cd(f"{tmp_dir}/requests") - - session.run("pytest", "tests") - - -@nox.session() -def format(session): - """Run code formatters.""" - session.install("pre-commit") - session.run("pre-commit", "--version") - - process = subprocess.run( - "pre-commit", "run", "--all-files", - env=session.env, - text=True, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - ) - # Ensure that pre-commit itself ran successfully - assert process.returncode in (0, 1) - - lint(session) - - -@nox.session -def lint(session): - session.install("pre-commit") - session.run("pre-commit", "run", "--all-files") - - -@nox.session -def docs(session): - session.install("-r", "docs/requirements.txt") - session.install(".socks,secure,brotli") - - session.chdir("docs") - if os.path.exists("_build"): - shutil.rmtree("_build") - session.run("sphinx-build", "-b", "html", "-W", ".", "_build/html")
View file
_service:tar_scm:1.26.12.tar.gz/CHANGES.rst -> _service:tar_scm:1.26.16.tar.gz/CHANGES.rst
Changed
@@ -1,6 +1,37 @@ Changes ======= +1.26.16 (2023-05-23) +-------------------- + +* Fixed thread-safety issue where accessing a ``PoolManager`` with many distinct origins + would cause connection pools to be closed while requests are in progress (`#2954 <https://github.com/urllib3/urllib3/pull/2954>`_) + + +1.26.15 (2023-03-10) +-------------------- + +* Fix socket timeout value when ``HTTPConnection`` is reused (`#2645 <https://github.com/urllib3/urllib3/issues/2645>`__) +* Remove "!" character from the unreserved characters in IPv6 Zone ID parsing + (`#2899 <https://github.com/urllib3/urllib3/issues/2899>`__) +* Fix IDNA handling of '\x80' byte (`#2901 <https://github.com/urllib3/urllib3/issues/2901>`__) + +1.26.14 (2023-01-11) +-------------------- + +* Fixed parsing of port 0 (zero) returning None, instead of 0. (`#2850 <https://github.com/urllib3/urllib3/issues/2850>`__) +* Removed deprecated getheaders() calls in contrib module. + +1.26.13 (2022-11-23) +-------------------- + +* Deprecated the ``HTTPResponse.getheaders()`` and ``HTTPResponse.getheader()`` methods. +* Fixed an issue where parsing a URL with leading zeroes in the port would be rejected + even when the port number after removing the zeroes was valid. +* Fixed a deprecation warning when using cryptography v39.0.0. +* Removed the ``<4`` in the ``Requires-Python`` packaging metadata field. + + 1.26.12 (2022-08-22) --------------------
View file
_service:tar_scm:1.26.16.tar.gz/PKG-INFO
Added
@@ -0,0 +1,1469 @@ +Metadata-Version: 2.1 +Name: urllib3 +Version: 1.26.16 +Summary: HTTP library with thread-safe connection pooling, file post, and more. +Home-page: https://urllib3.readthedocs.io/ +Author: Andrey Petrov +Author-email: andrey.petrov@shazow.net +License: MIT +Project-URL: Documentation, https://urllib3.readthedocs.io/ +Project-URL: Code, https://github.com/urllib3/urllib3 +Project-URL: Issue tracker, https://github.com/urllib3/urllib3/issues +Keywords: urllib httplib threadsafe filepost http https ssl pooling +Classifier: Environment :: Web Environment +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Internet :: WWW/HTTP +Classifier: Topic :: Software Development :: Libraries +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.* +Description-Content-Type: text/x-rst +Provides-Extra: brotli +Provides-Extra: secure +Provides-Extra: socks +License-File: LICENSE.txt + + +urllib3 is a powerful, *user-friendly* HTTP client for Python. Much of the +Python ecosystem already uses urllib3 and you should too. +urllib3 brings many critical features that are missing from the Python +standard libraries: + +- Thread safety. +- Connection pooling. +- Client-side SSL/TLS verification. +- File uploads with multipart encoding. +- Helpers for retrying requests and dealing with HTTP redirects. +- Support for gzip, deflate, and brotli encoding. +- Proxy support for HTTP and SOCKS. +- 100% test coverage. + +urllib3 is powerful and easy to use: + +.. code-block:: python + + >>> import urllib3 + >>> http = urllib3.PoolManager() + >>> r = http.request('GET', 'http://httpbin.org/robots.txt') + >>> r.status + 200 + >>> r.data + 'User-agent: *\nDisallow: /deny\n' + + +Installing +---------- + +urllib3 can be installed with `pip <https://pip.pypa.io>`_:: + + $ python -m pip install urllib3 + +Alternatively, you can grab the latest source code from `GitHub <https://github.com/urllib3/urllib3>`_:: + + $ git clone https://github.com/urllib3/urllib3.git + $ cd urllib3 + $ git checkout 1.26.x + $ pip install . + + +Documentation +------------- + +urllib3 has usage and reference documentation at `urllib3.readthedocs.io <https://urllib3.readthedocs.io>`_. + + +Contributing +------------ + +urllib3 happily accepts contributions. Please see our +`contributing documentation <https://urllib3.readthedocs.io/en/latest/contributing.html>`_ +for some tips on getting started. + + +Security Disclosures +-------------------- + +To report a security vulnerability, please use the +`Tidelift security contact <https://tidelift.com/security>`_. +Tidelift will coordinate the fix and disclosure with maintainers. + + +Maintainers +----------- + +- `@sethmlarson <https://github.com/sethmlarson>`__ (Seth M. Larson) +- `@pquentin <https://github.com/pquentin>`__ (Quentin Pradet) +- `@theacodes <https://github.com/theacodes>`__ (Thea Flowers) +- `@haikuginger <https://github.com/haikuginger>`__ (Jess Shapiro) +- `@lukasa <https://github.com/lukasa>`__ (Cory Benfield) +- `@sigmavirus24 <https://github.com/sigmavirus24>`__ (Ian Stapleton Cordasco) +- `@shazow <https://github.com/shazow>`__ (Andrey Petrov) + +👋 + + +Sponsorship +----------- + +If your company benefits from this library, please consider `sponsoring its +development <https://urllib3.readthedocs.io/en/latest/sponsors.html>`_. + + +For Enterprise +-------------- + +.. |tideliftlogo| image:: https://nedbatchelder.com/pix/Tidelift_Logos_RGB_Tidelift_Shorthand_On-White_small.png + :width: 75 + :alt: Tidelift + +.. list-table:: + :widths: 10 100 + + * - |tideliftlogo| + - Professional support for urllib3 is available as part of the `Tidelift + Subscription`_. Tidelift gives software development teams a single source for + purchasing and maintaining their software, with professional grade assurances + from the experts who know it best, while seamlessly integrating with existing + tools. + +.. _Tidelift Subscription: https://tidelift.com/subscription/pkg/pypi-urllib3?utm_source=pypi-urllib3&utm_medium=referral&utm_campaign=readme + + +Changes +======= + +1.26.16 (2023-05-23) +-------------------- + +* Fixed thread-safety issue where accessing a ``PoolManager`` with many distinct origins + would cause connection pools to be closed while requests are in progress (`#2954 <https://github.com/urllib3/urllib3/pull/2954>`_) + + +1.26.15 (2023-03-10) +-------------------- + +* Fix socket timeout value when ``HTTPConnection`` is reused (`#2645 <https://github.com/urllib3/urllib3/issues/2645>`__) +* Remove "!" character from the unreserved characters in IPv6 Zone ID parsing + (`#2899 <https://github.com/urllib3/urllib3/issues/2899>`__) +* Fix IDNA handling of '\x80' byte (`#2901 <https://github.com/urllib3/urllib3/issues/2901>`__) + +1.26.14 (2023-01-11) +-------------------- + +* Fixed parsing of port 0 (zero) returning None, instead of 0. (`#2850 <https://github.com/urllib3/urllib3/issues/2850>`__) +* Removed deprecated getheaders() calls in contrib module. + +1.26.13 (2022-11-23) +-------------------- + +* Deprecated the ``HTTPResponse.getheaders()`` and ``HTTPResponse.getheader()`` methods. +* Fixed an issue where parsing a URL with leading zeroes in the port would be rejected + even when the port number after removing the zeroes was valid. +* Fixed a deprecation warning when using cryptography v39.0.0. +* Removed the ``<4`` in the ``Requires-Python`` packaging metadata field. + + +1.26.12 (2022-08-22) +-------------------- + +* Deprecated the `urllib3secure` extra and the `urllib3.contrib.pyopenssl` module. + Both will be removed in v2.x. See this `GitHub issue <https://github.com/urllib3/urllib3/issues/2680>`_ + for justification and info on how to migrate. + + +1.26.11 (2022-07-25) +-------------------- + +* Fixed an issue where reading more than 2 GiB in a call to ``HTTPResponse.read`` would + raise an ``OverflowError`` on Python 3.9 and earlier. + + +1.26.10 (2022-07-07) +-------------------- + +* Removed support for Python 3.5 +* Fixed an issue where a ``ProxyError`` recommending configuring the proxy as HTTP + instead of HTTPS could appear even when an HTTPS proxy wasn't configured. +
View file
_service:tar_scm:1.26.12.tar.gz/README.rst -> _service:tar_scm:1.26.16.tar.gz/README.rst
Changed
@@ -2,7 +2,7 @@ <p align="center"> <a href="https://github.com/urllib3/urllib3"> - <img src="./docs/images/banner.svg" width="60%" alt="urllib3" /> + <img src="./docs/_static/banner.svg" width="60%" alt="urllib3" /> </a> </p> <p align="center">
View file
_service:tar_scm:1.26.12.tar.gz/dev-requirements.txt -> _service:tar_scm:1.26.16.tar.gz/dev-requirements.txt
Changed
@@ -1,7 +1,8 @@ mock==3.0.5 -coverage~=5.0 +coverage~=5.0;python_version<="2.7" +coverage~=6.0;python_version>="3.6" tornado==5.1.1;python_version<="2.7" -tornado==6.1.0;python_version>"3.5" +tornado==6.1.0;python_version>="3.6" PySocks==1.7.1 # https://github.com/Anorov/PySocks/issues/131 win-inet-pton==1.1.0 @@ -12,7 +13,7 @@ flaky==3.7.0 trustme==0.7.0 cryptography==3.2.1;python_version<"3.6" -cryptography==3.4.7;python_version>="3.6" +cryptography==38.0.3;python_version>="3.6" python-dateutil==2.8.1 # https://github.com/GrahamDumpleton/wrapt/issues/189
View file
_service:tar_scm:1.26.12.tar.gz/docs/v2-roadmap.rst -> _service:tar_scm:1.26.16.tar.gz/docs/v2-roadmap.rst
Changed
@@ -80,15 +80,15 @@ available. -**✨ Optimized for Python 3.6+** +**✨ Optimized for Python 3.7+** -------------------------------- In v2.0 we'll be specifically be targeting -CPython 3.6+ and PyPy 7.0+ (compatible with CPython 3.6) -and dropping support Python versions 2.7 and 3.5. +CPython 3.7+ and PyPy 7.3.10+ (compatible with CPython 3.8) +and dropping support Python versions 2.7 and 3.6. By dropping end-of-life Python versions we're able to optimize -the codebase for Python 3.6+ by using new features to improve +the codebase for Python 3.7+ by using new features to improve performance and reduce the amount of code that needs to be executed in order to support legacy versions.
View file
_service:tar_scm:1.26.12.tar.gz/setup.cfg -> _service:tar_scm:1.26.16.tar.gz/setup.cfg
Changed
@@ -1,32 +1,37 @@ flake8 ignore = E501, E203, W503, W504 -exclude=./docs/conf.py,./src/urllib3/packages/* -max-line-length=99 +exclude = ./docs/conf.py,./src/urllib3/packages/* +max-line-length = 99 bdist_wheel universal = 1 metadata license_file = LICENSE.txt -provides-extra = - secure - socks - brotli -requires-dist = - pyOpenSSL>=0.14; extra == 'secure' - cryptography>=1.3.4; extra == 'secure' - idna>=2.0.0; extra == 'secure' - certifi; extra == 'secure' - ipaddress; python_version=="2.7" and extra == 'secure' - urllib3-secure-extra; extra == 'secure' - PySocks>=1.5.6,<2.0,!=1.5.7; extra == 'socks' - brotli>=1.0.9; (os_name != 'nt' or python_version >= '3') and platform_python_implementation == 'CPython' and extra == 'brotli' - brotlicffi>=0.8.0; (os_name != 'nt' or python_version >= '3') and platform_python_implementation != 'CPython' and extra == 'brotli' - brotlipy>=0.6.0; os_name == 'nt' and python_version < '3' and extra == 'brotli' +provides-extra = + secure + socks + brotli +requires-dist = + pyOpenSSL>=0.14; extra == 'secure' + cryptography>=1.3.4; extra == 'secure' + idna>=2.0.0; extra == 'secure' + certifi; extra == 'secure' + ipaddress; python_version=="2.7" and extra == 'secure' + urllib3-secure-extra; extra == 'secure' + PySocks>=1.5.6,<2.0,!=1.5.7; extra == 'socks' + brotli>=1.0.9; (os_name != 'nt' or python_version >= '3') and platform_python_implementation == 'CPython' and extra == 'brotli' + brotlicffi>=0.8.0; (os_name != 'nt' or python_version >= '3') and platform_python_implementation != 'CPython' and extra == 'brotli' + brotlipy>=0.6.0; os_name == 'nt' and python_version < '3' and extra == 'brotli' tool:pytest xfail_strict = true python_classes = Test *TestCase isort -profile=black +profile = black + +egg_info +tag_build = +tag_date = 0 +
View file
_service:tar_scm:1.26.12.tar.gz/setup.py -> _service:tar_scm:1.26.16.tar.gz/setup.py
Changed
@@ -82,7 +82,7 @@ , package_dir={"": "src"}, requires=, - python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4", + python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*", extras_require={ "brotli": "brotli>=1.0.9; (os_name != 'nt' or python_version >= '3') and platform_python_implementation == 'CPython'",
View file
_service:tar_scm:1.26.16.tar.gz/src/urllib3.egg-info
Added
+(directory)
View file
_service:tar_scm:1.26.16.tar.gz/src/urllib3.egg-info/PKG-INFO
Added
@@ -0,0 +1,1469 @@ +Metadata-Version: 2.1 +Name: urllib3 +Version: 1.26.16 +Summary: HTTP library with thread-safe connection pooling, file post, and more. +Home-page: https://urllib3.readthedocs.io/ +Author: Andrey Petrov +Author-email: andrey.petrov@shazow.net +License: MIT +Project-URL: Documentation, https://urllib3.readthedocs.io/ +Project-URL: Code, https://github.com/urllib3/urllib3 +Project-URL: Issue tracker, https://github.com/urllib3/urllib3/issues +Keywords: urllib httplib threadsafe filepost http https ssl pooling +Classifier: Environment :: Web Environment +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Internet :: WWW/HTTP +Classifier: Topic :: Software Development :: Libraries +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.* +Description-Content-Type: text/x-rst +Provides-Extra: brotli +Provides-Extra: secure +Provides-Extra: socks +License-File: LICENSE.txt + + +urllib3 is a powerful, *user-friendly* HTTP client for Python. Much of the +Python ecosystem already uses urllib3 and you should too. +urllib3 brings many critical features that are missing from the Python +standard libraries: + +- Thread safety. +- Connection pooling. +- Client-side SSL/TLS verification. +- File uploads with multipart encoding. +- Helpers for retrying requests and dealing with HTTP redirects. +- Support for gzip, deflate, and brotli encoding. +- Proxy support for HTTP and SOCKS. +- 100% test coverage. + +urllib3 is powerful and easy to use: + +.. code-block:: python + + >>> import urllib3 + >>> http = urllib3.PoolManager() + >>> r = http.request('GET', 'http://httpbin.org/robots.txt') + >>> r.status + 200 + >>> r.data + 'User-agent: *\nDisallow: /deny\n' + + +Installing +---------- + +urllib3 can be installed with `pip <https://pip.pypa.io>`_:: + + $ python -m pip install urllib3 + +Alternatively, you can grab the latest source code from `GitHub <https://github.com/urllib3/urllib3>`_:: + + $ git clone https://github.com/urllib3/urllib3.git + $ cd urllib3 + $ git checkout 1.26.x + $ pip install . + + +Documentation +------------- + +urllib3 has usage and reference documentation at `urllib3.readthedocs.io <https://urllib3.readthedocs.io>`_. + + +Contributing +------------ + +urllib3 happily accepts contributions. Please see our +`contributing documentation <https://urllib3.readthedocs.io/en/latest/contributing.html>`_ +for some tips on getting started. + + +Security Disclosures +-------------------- + +To report a security vulnerability, please use the +`Tidelift security contact <https://tidelift.com/security>`_. +Tidelift will coordinate the fix and disclosure with maintainers. + + +Maintainers +----------- + +- `@sethmlarson <https://github.com/sethmlarson>`__ (Seth M. Larson) +- `@pquentin <https://github.com/pquentin>`__ (Quentin Pradet) +- `@theacodes <https://github.com/theacodes>`__ (Thea Flowers) +- `@haikuginger <https://github.com/haikuginger>`__ (Jess Shapiro) +- `@lukasa <https://github.com/lukasa>`__ (Cory Benfield) +- `@sigmavirus24 <https://github.com/sigmavirus24>`__ (Ian Stapleton Cordasco) +- `@shazow <https://github.com/shazow>`__ (Andrey Petrov) + +👋 + + +Sponsorship +----------- + +If your company benefits from this library, please consider `sponsoring its +development <https://urllib3.readthedocs.io/en/latest/sponsors.html>`_. + + +For Enterprise +-------------- + +.. |tideliftlogo| image:: https://nedbatchelder.com/pix/Tidelift_Logos_RGB_Tidelift_Shorthand_On-White_small.png + :width: 75 + :alt: Tidelift + +.. list-table:: + :widths: 10 100 + + * - |tideliftlogo| + - Professional support for urllib3 is available as part of the `Tidelift + Subscription`_. Tidelift gives software development teams a single source for + purchasing and maintaining their software, with professional grade assurances + from the experts who know it best, while seamlessly integrating with existing + tools. + +.. _Tidelift Subscription: https://tidelift.com/subscription/pkg/pypi-urllib3?utm_source=pypi-urllib3&utm_medium=referral&utm_campaign=readme + + +Changes +======= + +1.26.16 (2023-05-23) +-------------------- + +* Fixed thread-safety issue where accessing a ``PoolManager`` with many distinct origins + would cause connection pools to be closed while requests are in progress (`#2954 <https://github.com/urllib3/urllib3/pull/2954>`_) + + +1.26.15 (2023-03-10) +-------------------- + +* Fix socket timeout value when ``HTTPConnection`` is reused (`#2645 <https://github.com/urllib3/urllib3/issues/2645>`__) +* Remove "!" character from the unreserved characters in IPv6 Zone ID parsing + (`#2899 <https://github.com/urllib3/urllib3/issues/2899>`__) +* Fix IDNA handling of '\x80' byte (`#2901 <https://github.com/urllib3/urllib3/issues/2901>`__) + +1.26.14 (2023-01-11) +-------------------- + +* Fixed parsing of port 0 (zero) returning None, instead of 0. (`#2850 <https://github.com/urllib3/urllib3/issues/2850>`__) +* Removed deprecated getheaders() calls in contrib module. + +1.26.13 (2022-11-23) +-------------------- + +* Deprecated the ``HTTPResponse.getheaders()`` and ``HTTPResponse.getheader()`` methods. +* Fixed an issue where parsing a URL with leading zeroes in the port would be rejected + even when the port number after removing the zeroes was valid. +* Fixed a deprecation warning when using cryptography v39.0.0. +* Removed the ``<4`` in the ``Requires-Python`` packaging metadata field. + + +1.26.12 (2022-08-22) +-------------------- + +* Deprecated the `urllib3secure` extra and the `urllib3.contrib.pyopenssl` module. + Both will be removed in v2.x. See this `GitHub issue <https://github.com/urllib3/urllib3/issues/2680>`_ + for justification and info on how to migrate. + + +1.26.11 (2022-07-25) +-------------------- + +* Fixed an issue where reading more than 2 GiB in a call to ``HTTPResponse.read`` would + raise an ``OverflowError`` on Python 3.9 and earlier. + + +1.26.10 (2022-07-07) +-------------------- + +* Removed support for Python 3.5 +* Fixed an issue where a ``ProxyError`` recommending configuring the proxy as HTTP + instead of HTTPS could appear even when an HTTPS proxy wasn't configured. +
View file
_service:tar_scm:1.26.16.tar.gz/src/urllib3.egg-info/SOURCES.txt
Added
@@ -0,0 +1,135 @@ +CHANGES.rst +LICENSE.txt +MANIFEST.in +README.rst +dev-requirements.txt +setup.cfg +setup.py +docs/Makefile +docs/advanced-usage.rst +docs/conf.py +docs/contributing.rst +docs/index.rst +docs/make.bat +docs/requirements.txt +docs/sponsors.rst +docs/user-guide.rst +docs/v2-roadmap.rst +docs/_static/banner.svg +docs/_static/dark-logo.svg +docs/images/demo-button.png +docs/images/favicon.png +docs/images/learn-more-button.png +docs/images/logo.png +docs/images/logo.svg +docs/reference/index.rst +docs/reference/urllib3.connection.rst +docs/reference/urllib3.connectionpool.rst +docs/reference/urllib3.exceptions.rst +docs/reference/urllib3.fields.rst +docs/reference/urllib3.poolmanager.rst +docs/reference/urllib3.request.rst +docs/reference/urllib3.response.rst +docs/reference/urllib3.util.rst +docs/reference/contrib/appengine.rst +docs/reference/contrib/index.rst +docs/reference/contrib/ntlmpool.rst +docs/reference/contrib/pyopenssl.rst +docs/reference/contrib/securetransport.rst +docs/reference/contrib/socks.rst +dummyserver/__init__.py +dummyserver/handlers.py +dummyserver/proxy.py +dummyserver/server.py +dummyserver/testcase.py +dummyserver/certs/README.rst +dummyserver/certs/cacert.key +dummyserver/certs/cacert.pem +dummyserver/certs/server.crt +dummyserver/certs/server.key +src/urllib3/__init__.py +src/urllib3/_collections.py +src/urllib3/_version.py +src/urllib3/connection.py +src/urllib3/connectionpool.py +src/urllib3/exceptions.py +src/urllib3/fields.py +src/urllib3/filepost.py +src/urllib3/poolmanager.py +src/urllib3/request.py +src/urllib3/response.py +src/urllib3.egg-info/PKG-INFO +src/urllib3.egg-info/SOURCES.txt +src/urllib3.egg-info/dependency_links.txt +src/urllib3.egg-info/requires.txt +src/urllib3.egg-info/top_level.txt +src/urllib3/contrib/__init__.py +src/urllib3/contrib/_appengine_environ.py +src/urllib3/contrib/appengine.py +src/urllib3/contrib/ntlmpool.py +src/urllib3/contrib/pyopenssl.py +src/urllib3/contrib/securetransport.py +src/urllib3/contrib/socks.py +src/urllib3/contrib/_securetransport/__init__.py +src/urllib3/contrib/_securetransport/bindings.py +src/urllib3/contrib/_securetransport/low_level.py +src/urllib3/packages/__init__.py +src/urllib3/packages/six.py +src/urllib3/packages/backports/__init__.py +src/urllib3/packages/backports/makefile.py +src/urllib3/packages/backports/weakref_finalize.py +src/urllib3/util/__init__.py +src/urllib3/util/connection.py +src/urllib3/util/proxy.py +src/urllib3/util/queue.py +src/urllib3/util/request.py +src/urllib3/util/response.py +src/urllib3/util/retry.py +src/urllib3/util/ssl_.py +src/urllib3/util/ssl_match_hostname.py +src/urllib3/util/ssltransport.py +src/urllib3/util/timeout.py +src/urllib3/util/url.py +src/urllib3/util/wait.py +test/__init__.py +test/benchmark.py +test/conftest.py +test/port_helpers.py +test/socketpair_helper.py +test/test_collections.py +test/test_compatibility.py +test/test_connection.py +test/test_connectionpool.py +test/test_exceptions.py +test/test_fields.py +test/test_filepost.py +test/test_no_ssl.py +test/test_poolmanager.py +test/test_proxymanager.py +test/test_queue_monkeypatch.py +test/test_response.py +test/test_retry.py +test/test_retry_deprecated.py +test/test_ssl.py +test/test_ssltransport.py +test/test_util.py +test/test_wait.py +test/tz_stub.py +test/appengine/__init__.py +test/appengine/conftest.py +test/appengine/test_gae_manager.py +test/appengine/test_urlfetch.py +test/contrib/__init__.py +test/contrib/duplicate_san.pem +test/contrib/test_pyopenssl.py +test/contrib/test_pyopenssl_dependencies.py +test/contrib/test_securetransport.py +test/contrib/test_socks.py +test/with_dummyserver/__init__.py +test/with_dummyserver/test_chunked_transfer.py +test/with_dummyserver/test_connectionpool.py +test/with_dummyserver/test_https.py +test/with_dummyserver/test_no_ssl.py +test/with_dummyserver/test_poolmanager.py +test/with_dummyserver/test_proxy_poolmanager.py +test/with_dummyserver/test_socketlevel.py \ No newline at end of file
View file
_service:tar_scm:1.26.16.tar.gz/src/urllib3.egg-info/dependency_links.txt
Added
@@ -0,0 +1,1 @@ +
View file
_service:tar_scm:1.26.16.tar.gz/src/urllib3.egg-info/requires.txt
Added
@@ -0,0 +1,24 @@ + +brotli + +brotli:(os_name != "nt" or python_version >= "3") and platform_python_implementation != "CPython" +brotlicffi>=0.8.0 + +brotli:(os_name != "nt" or python_version >= "3") and platform_python_implementation == "CPython" +brotli>=1.0.9 + +brotli:os_name == "nt" and python_version < "3" +brotlipy>=0.6.0 + +secure +pyOpenSSL>=0.14 +cryptography>=1.3.4 +idna>=2.0.0 +certifi +urllib3-secure-extra + +secure:python_version == "2.7" +ipaddress + +socks +PySocks!=1.5.7,<2.0,>=1.5.6
View file
_service:tar_scm:1.26.16.tar.gz/src/urllib3.egg-info/top_level.txt
Added
@@ -0,0 +1,1 @@ +urllib3
View file
_service:tar_scm:1.26.12.tar.gz/src/urllib3/_version.py -> _service:tar_scm:1.26.16.tar.gz/src/urllib3/_version.py
Changed
@@ -1,2 +1,2 @@ # This file is protected via CODEOWNERS -__version__ = "1.26.12" +__version__ = "1.26.16"
View file
_service:tar_scm:1.26.12.tar.gz/src/urllib3/connection.py -> _service:tar_scm:1.26.16.tar.gz/src/urllib3/connection.py
Changed
@@ -229,6 +229,11 @@ ) def request(self, method, url, body=None, headers=None): + # Update the inner socket's timeout value to send the request. + # This only triggers if the connection is re-used. + if getattr(self, "sock", None) is not None: + self.sock.settimeout(self.timeout) + if headers is None: headers = {} else:
View file
_service:tar_scm:1.26.12.tar.gz/src/urllib3/connectionpool.py -> _service:tar_scm:1.26.16.tar.gz/src/urllib3/connectionpool.py
Changed
@@ -50,6 +50,13 @@ from .util.url import _normalize_host as normalize_host from .util.url import get_host, parse_url +try: # Platform-specific: Python 3 + import weakref + + weakref_finalize = weakref.finalize +except AttributeError: # Platform-specific: Python 2 + from .packages.backports.weakref_finalize import weakref_finalize + xrange = six.moves.xrange log = logging.getLogger(__name__) @@ -220,6 +227,16 @@ self.conn_kw"proxy" = self.proxy self.conn_kw"proxy_config" = self.proxy_config + # Do not pass 'self' as callback to 'finalize'. + # Then the 'finalize' would keep an endless living (leak) to self. + # By just passing a reference to the pool allows the garbage collector + # to free self if nobody else has a reference to it. + pool = self.pool + + # Close all the HTTPConnections in the pool before the + # HTTPConnectionPool object is garbage collected. + weakref_finalize(self, _close_pool_connections, pool) + def _new_conn(self): """ Return a fresh :class:`HTTPConnection`. @@ -379,7 +396,7 @@ timeout_obj = self._get_timeout(timeout) timeout_obj.start_connect() - conn.timeout = timeout_obj.connect_timeout + conn.timeout = Timeout.resolve_default_timeout(timeout_obj.connect_timeout) # Trigger any extra validation we need to do. try: @@ -489,14 +506,8 @@ # Disable access to the pool old_pool, self.pool = self.pool, None - try: - while True: - conn = old_pool.get(block=False) - if conn: - conn.close() - - except queue.Empty: - pass # Done. + # Close all the HTTPConnections in the pool. + _close_pool_connections(old_pool) def is_same_host(self, url): """ @@ -862,7 +873,7 @@ ) # Check if we should retry the HTTP response. - has_retry_after = bool(response.getheader("Retry-After")) + has_retry_after = bool(response.headers.get("Retry-After")) if retries.is_retry(method, response.status, has_retry_after): try: retries = retries.increment(method, url, response=response, _pool=self) @@ -1108,3 +1119,14 @@ if host.startswith("") and host.endswith(""): host = host1:-1 return host + + +def _close_pool_connections(pool): + """Drains a queue of connections and closes each one.""" + try: + while True: + conn = pool.get(block=False) + if conn: + conn.close() + except queue.Empty: + pass # Done.
View file
_service:tar_scm:1.26.12.tar.gz/src/urllib3/contrib/appengine.py -> _service:tar_scm:1.26.16.tar.gz/src/urllib3/contrib/appengine.py
Changed
@@ -224,7 +224,7 @@ ) # Check if we should retry the HTTP response. - has_retry_after = bool(http_response.getheader("Retry-After")) + has_retry_after = bool(http_response.headers.get("Retry-After")) if retries.is_retry(method, http_response.status, has_retry_after): retries = retries.increment(method, url, response=http_response, _pool=self) log.debug("Retry: %s", url)
View file
_service:tar_scm:1.26.12.tar.gz/src/urllib3/contrib/ntlmpool.py -> _service:tar_scm:1.26.16.tar.gz/src/urllib3/contrib/ntlmpool.py
Changed
@@ -69,7 +69,7 @@ log.debug("Request headers: %s", headers) conn.request("GET", self.authurl, None, headers) res = conn.getresponse() - reshdr = dict(res.getheaders()) + reshdr = dict(res.headers) log.debug("Response status: %s %s", res.status, res.reason) log.debug("Response headers: %s", reshdr) log.debug("Response data: %s ...", res.read(100)) @@ -101,7 +101,7 @@ conn.request("GET", self.authurl, None, headers) res = conn.getresponse() log.debug("Response status: %s %s", res.status, res.reason) - log.debug("Response headers: %s", dict(res.getheaders())) + log.debug("Response headers: %s", dict(res.headers)) log.debug("Response data: %s ...", res.read():100) if res.status != 200: if res.status == 401:
View file
_service:tar_scm:1.26.12.tar.gz/src/urllib3/contrib/pyopenssl.py -> _service:tar_scm:1.26.16.tar.gz/src/urllib3/contrib/pyopenssl.py
Changed
@@ -47,10 +47,10 @@ """ from __future__ import absolute_import +import OpenSSL.crypto import OpenSSL.SSL from cryptography import x509 from cryptography.hazmat.backends.openssl import backend as openssl_backend -from cryptography.hazmat.backends.openssl.x509 import _Certificate try: from cryptography.x509 import UnsupportedExtension @@ -228,9 +228,8 @@ if hasattr(peer_cert, "to_cryptography"): cert = peer_cert.to_cryptography() else: - # This is technically using private APIs, but should work across all - # relevant versions before PyOpenSSL got a proper API for this. - cert = _Certificate(openssl_backend, peer_cert._x509) + der = OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_ASN1, peer_cert) + cert = x509.load_der_x509_certificate(der, openssl_backend) # We want to find the SAN extension. Ask Cryptography to locate it (it's # faster than looping in Python)
View file
_service:tar_scm:1.26.16.tar.gz/src/urllib3/packages/backports/weakref_finalize.py
Added
@@ -0,0 +1,155 @@ +# -*- coding: utf-8 -*- +""" +backports.weakref_finalize +~~~~~~~~~~~~~~~~~~ + +Backports the Python 3 ``weakref.finalize`` method. +""" +from __future__ import absolute_import + +import itertools +import sys +from weakref import ref + +__all__ = "weakref_finalize" + + +class weakref_finalize(object): + """Class for finalization of weakrefable objects + finalize(obj, func, *args, **kwargs) returns a callable finalizer + object which will be called when obj is garbage collected. The + first time the finalizer is called it evaluates func(*arg, **kwargs) + and returns the result. After this the finalizer is dead, and + calling it just returns None. + When the program exits any remaining finalizers for which the + atexit attribute is true will be run in reverse order of creation. + By default atexit is true. + """ + + # Finalizer objects don't have any state of their own. They are + # just used as keys to lookup _Info objects in the registry. This + # ensures that they cannot be part of a ref-cycle. + + __slots__ = () + _registry = {} + _shutdown = False + _index_iter = itertools.count() + _dirty = False + _registered_with_atexit = False + + class _Info(object): + __slots__ = ("weakref", "func", "args", "kwargs", "atexit", "index") + + def __init__(self, obj, func, *args, **kwargs): + if not self._registered_with_atexit: + # We may register the exit function more than once because + # of a thread race, but that is harmless + import atexit + + atexit.register(self._exitfunc) + weakref_finalize._registered_with_atexit = True + info = self._Info() + info.weakref = ref(obj, self) + info.func = func + info.args = args + info.kwargs = kwargs or None + info.atexit = True + info.index = next(self._index_iter) + self._registryself = info + weakref_finalize._dirty = True + + def __call__(self, _=None): + """If alive then mark as dead and return func(*args, **kwargs); + otherwise return None""" + info = self._registry.pop(self, None) + if info and not self._shutdown: + return info.func(*info.args, **(info.kwargs or {})) + + def detach(self): + """If alive then mark as dead and return (obj, func, args, kwargs); + otherwise return None""" + info = self._registry.get(self) + obj = info and info.weakref() + if obj is not None and self._registry.pop(self, None): + return (obj, info.func, info.args, info.kwargs or {}) + + def peek(self): + """If alive then return (obj, func, args, kwargs); + otherwise return None""" + info = self._registry.get(self) + obj = info and info.weakref() + if obj is not None: + return (obj, info.func, info.args, info.kwargs or {}) + + @property + def alive(self): + """Whether finalizer is alive""" + return self in self._registry + + @property + def atexit(self): + """Whether finalizer should be called at exit""" + info = self._registry.get(self) + return bool(info) and info.atexit + + @atexit.setter + def atexit(self, value): + info = self._registry.get(self) + if info: + info.atexit = bool(value) + + def __repr__(self): + info = self._registry.get(self) + obj = info and info.weakref() + if obj is None: + return "<%s object at %#x; dead>" % (type(self).__name__, id(self)) + else: + return "<%s object at %#x; for %r at %#x>" % ( + type(self).__name__, + id(self), + type(obj).__name__, + id(obj), + ) + + @classmethod + def _select_for_exit(cls): + # Return live finalizers marked for exit, oldest first + L = (f, i) for (f, i) in cls._registry.items() if i.atexit + L.sort(key=lambda item: item1.index) + return f for (f, i) in L + + @classmethod + def _exitfunc(cls): + # At shutdown invoke finalizers for which atexit is true. + # This is called once all other non-daemonic threads have been + # joined. + reenable_gc = False + try: + if cls._registry: + import gc + + if gc.isenabled(): + reenable_gc = True + gc.disable() + pending = None + while True: + if pending is None or weakref_finalize._dirty: + pending = cls._select_for_exit() + weakref_finalize._dirty = False + if not pending: + break + f = pending.pop() + try: + # gc is disabled, so (assuming no daemonic + # threads) the following is the only line in + # this function which might trigger creation + # of a new finalizer + f() + except Exception: + sys.excepthook(*sys.exc_info()) + assert f not in cls._registry + finally: + # prevent any more finalizers from executing during shutdown + weakref_finalize._shutdown = True + if reenable_gc: + gc.enable()
View file
_service:tar_scm:1.26.12.tar.gz/src/urllib3/poolmanager.py -> _service:tar_scm:1.26.16.tar.gz/src/urllib3/poolmanager.py
Changed
@@ -171,7 +171,7 @@ def __init__(self, num_pools=10, headers=None, **connection_pool_kw): RequestMethods.__init__(self, headers) self.connection_pool_kw = connection_pool_kw - self.pools = RecentlyUsedContainer(num_pools, dispose_func=lambda p: p.close()) + self.pools = RecentlyUsedContainer(num_pools) # Locally set the pool classes and keys so other PoolManagers can # override them.
View file
_service:tar_scm:1.26.12.tar.gz/src/urllib3/response.py -> _service:tar_scm:1.26.16.tar.gz/src/urllib3/response.py
Changed
@@ -3,6 +3,7 @@ import io import logging import sys +import warnings import zlib from contextlib import contextmanager from socket import error as SocketError @@ -663,9 +664,21 @@ # Backwards-compatibility methods for http.client.HTTPResponse def getheaders(self): + warnings.warn( + "HTTPResponse.getheaders() is deprecated and will be removed " + "in urllib3 v2.1.0. Instead access HTTPResponse.headers directly.", + category=DeprecationWarning, + stacklevel=2, + ) return self.headers def getheader(self, name, default=None): + warnings.warn( + "HTTPResponse.getheader() is deprecated and will be removed " + "in urllib3 v2.1.0. Instead use HTTPResponse.headers.get(name, default).", + category=DeprecationWarning, + stacklevel=2, + ) return self.headers.get(name, default) # Backwards compatibility for http.cookiejar
View file
_service:tar_scm:1.26.12.tar.gz/src/urllib3/util/retry.py -> _service:tar_scm:1.26.16.tar.gz/src/urllib3/util/retry.py
Changed
@@ -394,7 +394,7 @@ def get_retry_after(self, response): """Get the value of Retry-After in seconds.""" - retry_after = response.getheader("Retry-After") + retry_after = response.headers.get("Retry-After") if retry_after is None: return None
View file
_service:tar_scm:1.26.12.tar.gz/src/urllib3/util/timeout.py -> _service:tar_scm:1.26.16.tar.gz/src/urllib3/util/timeout.py
Changed
@@ -2,9 +2,8 @@ import time -# The default socket timeout, used by httplib to indicate that no timeout was -# specified by the user -from socket import _GLOBAL_DEFAULT_TIMEOUT +# The default socket timeout, used by httplib to indicate that no timeout was; specified by the user +from socket import _GLOBAL_DEFAULT_TIMEOUT, getdefaulttimeout from ..exceptions import TimeoutStateError @@ -117,6 +116,10 @@ __str__ = __repr__ @classmethod + def resolve_default_timeout(cls, timeout): + return getdefaulttimeout() if timeout is cls.DEFAULT_TIMEOUT else timeout + + @classmethod def _validate_timeout(cls, value, name): """Check that a timeout attribute is valid.
View file
_service:tar_scm:1.26.12.tar.gz/src/urllib3/util/url.py -> _service:tar_scm:1.26.16.tar.gz/src/urllib3/util/url.py
Changed
@@ -50,7 +50,7 @@ "(?:(?:%(hex)s:){0,6}%(hex)s)?::", -UNRESERVED_PAT = r"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._!\-~" +UNRESERVED_PAT = r"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._\-~" IPV6_PAT = "(?:" + "|".join(x % _subs for x in _variations) + ")" ZONE_ID_PAT = "(?:%25|%)(?:" + UNRESERVED_PAT + "|%a-fA-F0-9{2})+" IPV6_ADDRZ_PAT = r"\" + IPV6_PAT + r"(?:" + ZONE_ID_PAT + r")?\" @@ -63,7 +63,7 @@ BRACELESS_IPV6_ADDRZ_RE = re.compile("^" + IPV6_ADDRZ_PAT2:-2 + "$") ZONE_ID_RE = re.compile("(" + ZONE_ID_PAT + r")\$") -_HOST_PORT_PAT = ("^(%s|%s|%s)(?::(0-9{0,5}))?$") % ( +_HOST_PORT_PAT = ("^(%s|%s|%s)(?::0*?(|0|1-90-9{0,4}))?$") % ( REG_NAME_PAT, IPV4_PAT, IPV6_ADDRZ_PAT, @@ -303,7 +303,7 @@ def _idna_encode(name): - if name and any(ord(x) > 128 for x in name): + if name and any(ord(x) >= 128 for x in name): try: import idna except ImportError:
View file
_service:tar_scm:1.26.12.tar.gz/test/test_poolmanager.py -> _service:tar_scm:1.26.16.tar.gz/test/test_poolmanager.py
Changed
@@ -1,3 +1,4 @@ +import gc import socket from test import resolvesLocalhostFQDN @@ -5,7 +6,7 @@ from mock import patch from urllib3 import connection_from_url -from urllib3.exceptions import ClosedPoolError, LocationValueError +from urllib3.exceptions import LocationValueError from urllib3.poolmanager import PoolKey, PoolManager, key_fn_by_scheme from urllib3.util import retry, timeout @@ -60,24 +61,12 @@ def test_manager_clear(self): p = PoolManager(5) - conn_pool = p.connection_from_url("http://google.com") + p.connection_from_url("http://google.com") assert len(p.pools) == 1 - conn = conn_pool._get_conn() - p.clear() assert len(p.pools) == 0 - with pytest.raises(ClosedPoolError): - conn_pool._get_conn() - - conn_pool._put_conn(conn) - - with pytest.raises(ClosedPoolError): - conn_pool._get_conn() - - assert len(p.pools) == 0 - @pytest.mark.parametrize("url", "http://@", None) def test_nohost(self, url): p = PoolManager(5) @@ -86,19 +75,8 @@ def test_contextmanager(self): with PoolManager(1) as p: - conn_pool = p.connection_from_url("http://google.com") + p.connection_from_url("http://google.com") assert len(p.pools) == 1 - conn = conn_pool._get_conn() - - assert len(p.pools) == 0 - - with pytest.raises(ClosedPoolError): - conn_pool._get_conn() - - conn_pool._put_conn(conn) - - with pytest.raises(ClosedPoolError): - conn_pool._get_conn() assert len(p.pools) == 0 @@ -397,3 +375,30 @@ conn.connect() assert create_connection.call_args00 == ("a::b%zone", 80) + + def test_thread_safty(self): + pool_manager = PoolManager(num_pools=2) + + # thread 1 gets a pool for host x + pool_1 = pool_manager.connection_from_url("http://host_x:80/") + + # thread 2 gets a pool for host y + pool_2 = pool_manager.connection_from_url("http://host_y:80/") + + # thread 3 gets a pool for host z + pool_3 = pool_manager.connection_from_url("http://host_z:80") + + # None of the pools should be closed, since all of them are referenced. + assert pool_1.pool is not None + assert pool_2.pool is not None + assert pool_3.pool is not None + + conn_queue = pool_1.pool + assert conn_queue.qsize() > 0 + + # thread 1 stops. + del pool_1 + gc.collect() + + # Connection should be closed, because reference to pool_1 is gone. + assert conn_queue.qsize() == 0
View file
_service:tar_scm:1.26.12.tar.gz/test/test_response.py -> _service:tar_scm:1.26.16.tar.gz/test/test_response.py
Changed
@@ -13,6 +13,7 @@ import pytest import six +from urllib3._collections import HTTPHeaderDict from urllib3.exceptions import ( DecodeError, IncompleteRead, @@ -57,12 +58,20 @@ def test_getheaders(self): headers = {"host": "example.com"} r = HTTPResponse(headers=headers) - assert r.getheaders() == headers + with pytest.warns( + DeprecationWarning, + match=r"HTTPResponse.getheaders\(\) is deprecated", + ): + assert r.getheaders() == HTTPHeaderDict(headers) def test_getheader(self): headers = {"host": "example.com"} r = HTTPResponse(headers=headers) - assert r.getheader("host") == "example.com" + with pytest.warns( + DeprecationWarning, + match=r"HTTPResponse.getheader\(\) is deprecated", + ): + assert r.getheader("host") == "example.com" class TestResponse(object):
View file
_service:tar_scm:1.26.12.tar.gz/test/test_ssltransport.py -> _service:tar_scm:1.26.16.tar.gz/test/test_ssltransport.py
Changed
@@ -202,8 +202,11 @@ assert ssock.selected_npn_protocol() is None shared_ciphers = ssock.shared_ciphers() - assert type(shared_ciphers) == list - assert len(shared_ciphers) > 0 + # SSLContext.shared_ciphers() changed behavior completely in a patch version. + # See: https://github.com/python/cpython/issues/96931 + assert shared_ciphers is None or ( + type(shared_ciphers) is list and len(shared_ciphers) > 0 + ) assert ssock.compression() is None
View file
_service:tar_scm:1.26.12.tar.gz/test/test_util.py -> _service:tar_scm:1.26.16.tar.gz/test/test_util.py
Changed
@@ -347,6 +347,17 @@ with pytest.raises(LocationParseError): parse_url("https://www.google.com:-80/") + def test_parse_url_remove_leading_zeros(self): + url = parse_url("https://example.com:0000000000080") + assert url.port == 80 + + def test_parse_url_only_zeros(self): + url = parse_url("https://example.com:0") + assert url.port == 0 + + url = parse_url("https://example.com:000000000000") + assert url.port == 0 + def test_Url_str(self): U = Url("http", host="google.com") assert str(U) == U.url
View file
_service:tar_scm:1.26.12.tar.gz/test/with_dummyserver/test_connectionpool.py -> _service:tar_scm:1.26.16.tar.gz/test/with_dummyserver/test_connectionpool.py
Changed
@@ -378,6 +378,59 @@ with HTTPConnectionPool(self.host, self.port, timeout=timeout) as pool: pool.request("GET", "/") + socket_timeout_reuse_testdata = pytest.mark.parametrize( + "timeout", "expect_settimeout_calls", + + (1, (1, 1)), + (None, (None, None)), + (Timeout(read=4), (None, 4)), + (Timeout(read=4, connect=5), (5, 4)), + (Timeout(connect=6), (6, None)), + , + ) + + @socket_timeout_reuse_testdata + def test_socket_timeout_updated_on_reuse_constructor( + self, timeout, expect_settimeout_calls + ): + with HTTPConnectionPool(self.host, self.port, timeout=timeout) as pool: + # Make a request to create a new connection. + pool.urlopen("GET", "/") + + # Grab the connection and mock the inner socket. + assert pool.pool is not None + conn = pool.pool.get_nowait() + conn_sock = mock.Mock(wraps=conn.sock) + conn.sock = conn_sock + pool._put_conn(conn) + + # Assert that sock.settimeout() is called with the new connect timeout, then the read timeout. + pool.urlopen("GET", "/", timeout=timeout) + conn_sock.settimeout.assert_has_calls( + mock.call(x) for x in expect_settimeout_calls + ) + + @socket_timeout_reuse_testdata + def test_socket_timeout_updated_on_reuse_parameter( + self, timeout, expect_settimeout_calls + ): + with HTTPConnectionPool(self.host, self.port) as pool: + # Make a request to create a new connection. + pool.urlopen("GET", "/", timeout=LONG_TIMEOUT) + + # Grab the connection and mock the inner socket. + assert pool.pool is not None + conn = pool.pool.get_nowait() + conn_sock = mock.Mock(wraps=conn.sock) + conn.sock = conn_sock + pool._put_conn(conn) + + # Assert that sock.settimeout() is called with the new connect timeout, then the read timeout. + pool.urlopen("GET", "/", timeout=timeout) + conn_sock.settimeout.assert_has_calls( + mock.call(x) for x in expect_settimeout_calls + ) + def test_tunnel(self): # note the actual httplib.py has no tests for this functionality timeout = Timeout(total=None)
View file
_service:tar_scm:1.26.12.tar.gz/test/with_dummyserver/test_socketlevel.py -> _service:tar_scm:1.26.16.tar.gz/test/with_dummyserver/test_socketlevel.py
Changed
@@ -776,7 +776,7 @@ # leaking it. Because we don't want to hang this thread, we # actually use select.select to confirm that a new request is # coming in: this lets us time the thread out. - rlist, _, _ = select.select(listener, , , 1) + rlist, _, _ = select.select(listener, , ) assert rlist new_sock = listener.accept()0 @@ -885,7 +885,7 @@ # Expect a new request. Because we don't want to hang this thread, # we actually use select.select to confirm that a new request is # coming in: this lets us time the thread out. - rlist, _, _ = select.select(listener, , , 5) + rlist, _, _ = select.select(listener, , ) assert rlist sock = listener.accept()0 consume_socket(sock) @@ -1221,10 +1221,11 @@ ssl_sock.close() self._start_server(socket_handler) - with HTTPSConnectionPool(self.host, self.port) as pool: - with pytest.raises(MaxRetryError) as cm: - pool.request("GET", "/", retries=0) - assert isinstance(cm.value.reason, SSLError) + with HTTPSConnectionPool(self.host, self.port, ca_certs=DEFAULT_CA) as pool: + with pytest.raises( + SSLError, match=r"(wrong version number|record overflow)" + ): + pool.request("GET", "/", retries=False) @notSecureTransport def test_ssl_read_timeout(self):
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2