diff --git a/python-urllib3.changes b/python-urllib3.changes index 22de61a..6b2d604 100644 --- a/python-urllib3.changes +++ b/python-urllib3.changes @@ -1,3 +1,57 @@ +------------------------------------------------------------------- +Sun May 14 12:37:09 UTC 2023 - Dirk Müller + +- update to 2.0.2: + * Fixed ``HTTPResponse.stream()`` to continue yielding bytes if + buffered decompressed data was still available to be read + even if the underlying socket is closed. This prevents + a compressed response from being truncated. + +------------------------------------------------------------------- +Wed May 10 07:26:42 UTC 2023 - Steve Kowalik + +- Update to 2.0.1: + * Fixed a socket leak when fingerprint or hostname verifications fail. + * Fixed an error when HTTPResponse.read(0) was the first read call or when + the internal response body buffer was otherwise empty. + * Removed support for Python 2.7, 3.5, and 3.6. + * Removed fallback on certificate commonName in match_hostname() function. + * Removed support for Python with an ssl module compiled with LibreSSL, + CiscoSSL, wolfSSL, and all other OpenSSL alternatives. + * Removed support for OpenSSL versions earlier than 1.1.1. + * Removed urllib3.contrib.appengine.AppEngineManager and support for Google + App Engine Standard Environment. + * Changed ssl_version to instead set the corresponding + SSLContext.minimum_version and SSLContext.maximum_version values. + * Changed default SSLContext.minimum_version to be TLSVersion.TLSv1_2 + in line with Python 3.10. + * Changed urllib3.util.create_urllib3_context to not override the system + cipher suites with a default value. + * Changed multipart/form-data header parameter formatting matches the + WHATWG HTML Standard as of 2021-06-10. + * Changed HTTPConnection.request() to always use lowercase chunk boundaries + when sending requests with Transfer-Encoding: chunked. + * Changed enforce_content_length default to True, preventing silent data + loss when reading streamed responses. + * Changed all parameters in the HTTPConnection and HTTPSConnection + constructors to be keyword-only except host and port. + * Changed HTTPConnection.getresponse() to set the socket timeout from + HTTPConnection.timeout value before reading data from the socket. + * Changed name of Retry.BACK0FF_MAX to be Retry.DEFAULT_BACKOFF_MAX. + * Changed TLS handshakes to use SSLContext.check_hostname when possible. + * Changed the default blocksize to 16KB to match OpenSSL's default read + amounts. + * Changed HTTPResponse.read() to raise an error when calling with + decode_content=False after using decode_content=True to prevent data loss. + * Fixed thread-safety issue where accessing a PoolManager with many + distinct origins would cause connection pools to be closed while + requests are in progress. + * Fixed the default value of HTTPSConnection.socket_options to match + HTTPConnection. + * Fixed a socket leak if HTTPConnection.connect() fails. +- Drop patch remove_mock.patch, included upstream. +- Fiddle with {Build,}Requires as appropiate, six finally dropped. + ------------------------------------------------------------------- Fri Apr 21 12:38:19 UTC 2023 - Dirk Müller diff --git a/python-urllib3.spec b/python-urllib3.spec index ce6288e..93d0752 100644 --- a/python-urllib3.spec +++ b/python-urllib3.spec @@ -26,28 +26,23 @@ %endif %{?sle15_python_module_pythons} Name: python-urllib3%{psuffix} -Version: 1.26.15 +Version: 2.0.2 Release: 0 Summary: HTTP library with thread-safe connection pooling, file post, and more License: MIT -Group: Development/Languages/Python URL: https://urllib3.readthedocs.org/ Source: https://files.pythonhosted.org/packages/source/u/urllib3/urllib3-%{version}.tar.gz -# PATCH-FIX-UPSTREAM remove_mock.patch gh#urllib3/urllib3#2108 mcepl@suse.com -# remove dependency on the external module mock -Patch0: remove_mock.patch BuildRequires: %{python_module base >= 3.7} -BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module six} +BuildRequires: %{python_module hatchling} +BuildRequires: %{python_module pip} BuildRequires: fdupes BuildRequires: python-rpm-macros #!BuildIgnore: python-requests Requires: ca-certificates-mozilla Requires: python-certifi -Requires: python-cryptography >= 1.3.4 +Requires: python-cryptography >= 1.9 Requires: python-idna >= 2.0.0 -Requires: python-pyOpenSSL >= 0.14 -Requires: python-six >= 1.12.0 +Requires: python-pyOpenSSL >= 17.1.0 Recommends: python-Brotli >= 1.0.9 Recommends: python-PySocks >= 1.5.6 BuildArch: noarch @@ -55,7 +50,7 @@ BuildArch: noarch BuildRequires: %{python_module Brotli >= 1.0.9} BuildRequires: %{python_module PySocks >= 1.5.6} BuildRequires: %{python_module certifi} -BuildRequires: %{python_module cryptography >= 1.3.4} +BuildRequires: %{python_module cryptography >= 1.9} BuildRequires: %{python_module dateutil} BuildRequires: %{python_module flaky} BuildRequires: %{python_module idna >= 2.0.0} @@ -67,6 +62,9 @@ BuildRequires: %{python_module python-dateutil} BuildRequires: %{python_module tornado >= 6} BuildRequires: %{python_module trustme >= 0.5.3} BuildRequires: %{python_module urllib3 >= %{version}} +BuildRequires: timezone +%else +Conflicts: python-urllib3 < 2 %endif %python_subpackages @@ -92,31 +90,14 @@ Highlights find . -type f -exec chmod a-x '{}' \; find . -name __pycache__ -type d -exec rm -fr {} + -# Drop the dummyserver tests, they fail in OBS -rm test/with_dummyserver/test_proxy_poolmanager.py -rm test/with_dummyserver/test_poolmanager.py -# Don't run the Google App Engine tests -rm -r test/appengine/ - %build -%python_build +%pyproject_wheel %install %if !%{with test} -%python_install +%pyproject_install -%{python_expand # Unbundle six -rm %{buildroot}/%{$python_sitelib}/urllib3/packages/six.py -rm %{buildroot}/%{$python_sitelib}/urllib3/packages/__pycache__/six*.pyc - -ln -s %{$python_sitelib}/six.py %{buildroot}/%{$python_sitelib}/urllib3/packages/six.py -ln -sf %{$python_sitelib}/__pycache__/six.cpython-%{$python_version_nodots}.opt-1.pyc \ - %{buildroot}/%{$python_sitelib}/urllib3/packages/__pycache__/ -ln -sf %{$python_sitelib}/__pycache__/six.cpython-%{$python_version_nodots}.pyc \ - %{buildroot}/%{$python_sitelib}/urllib3/packages/__pycache__/ - -%fdupes %{buildroot}%{$python_sitelib} -} +%python_expand %fdupes %{buildroot}%{$python_sitelib} %endif %if %{with test} @@ -131,13 +112,13 @@ skiplist="test_ssl_read_timeout or test_ssl_failed_fingerprint_verification or t skiplist+=" or test_recent_date" # too slow to run in obs (checks 2GiB of data) skiplist+=" or test_requesting_large_resources_via_ssl" -%pytest -k "not (${skiplist})" +%pytest -k "not (${skiplist})" --ignore test/with_dummyserver/test_socketlevel.py %endif %if ! %{with test} %files %{python_files} %license LICENSE.txt -%doc CHANGES.rst README.rst +%doc CHANGES.rst README.md %{python_sitelib}/urllib3 %{python_sitelib}/urllib3-%{version}*-info %endif diff --git a/remove_mock.patch b/remove_mock.patch deleted file mode 100644 index e7316ea..0000000 --- a/remove_mock.patch +++ /dev/null @@ -1,261 +0,0 @@ -Index: urllib3-1.26.10/docs/conf.py -=================================================================== ---- urllib3-1.26.10.orig/docs/conf.py -+++ urllib3-1.26.10/docs/conf.py -@@ -14,7 +14,10 @@ sys.path.insert(0, root_path) - # Mock some expensive/platform-specific modules so build will work. - # (https://read-the-docs.readthedocs.io/en/latest/faq.html#\ - # i-get-import-errors-on-libraries-that-depend-on-c-modules) --import mock -+try: -+ import unittest.mock as mock -+except ImportError: -+ import mock - - - class MockModule(mock.Mock): -Index: urllib3-1.26.10/test/contrib/test_pyopenssl.py -=================================================================== ---- urllib3-1.26.10.orig/test/contrib/test_pyopenssl.py -+++ urllib3-1.26.10/test/contrib/test_pyopenssl.py -@@ -1,7 +1,10 @@ - # -*- coding: utf-8 -*- - import os - --import mock -+try: -+ import unittest.mock as mock -+except ImportError: -+ import mock - import pytest - - try: -Index: urllib3-1.26.10/test/contrib/test_pyopenssl_dependencies.py -=================================================================== ---- urllib3-1.26.10.orig/test/contrib/test_pyopenssl_dependencies.py -+++ urllib3-1.26.10/test/contrib/test_pyopenssl_dependencies.py -@@ -1,6 +1,9 @@ - # -*- coding: utf-8 -*- - import pytest --from mock import Mock, patch -+try: -+ from unittest.mock import Mock, patch -+except ImportError: -+ from mock import Mock, patch - - try: - from urllib3.contrib.pyopenssl import extract_from_urllib3, inject_into_urllib3 -Index: urllib3-1.26.10/test/test_connection.py -=================================================================== ---- urllib3-1.26.10.orig/test/test_connection.py -+++ urllib3-1.26.10/test/test_connection.py -@@ -1,6 +1,9 @@ - import datetime - --import mock -+try: -+ import unittest.mock as mock -+except ImportError: -+ import mock - import pytest - - from urllib3.connection import RECENT_DATE, CertificateError, _match_hostname -Index: urllib3-1.26.10/test/test_connectionpool.py -=================================================================== ---- urllib3-1.26.10.orig/test/test_connectionpool.py -+++ urllib3-1.26.10/test/test_connectionpool.py -@@ -6,7 +6,10 @@ from ssl import SSLError as BaseSSLError - from test import SHORT_TIMEOUT - - import pytest --from mock import Mock -+try: -+ from unittest.mock import Mock -+except ImportError: -+ from mock import Mock - - from dummyserver.server import DEFAULT_CA - from urllib3._collections import HTTPHeaderDict -Index: urllib3-1.26.10/test/test_queue_monkeypatch.py -=================================================================== ---- urllib3-1.26.10.orig/test/test_queue_monkeypatch.py -+++ urllib3-1.26.10/test/test_queue_monkeypatch.py -@@ -1,6 +1,9 @@ - from __future__ import absolute_import - --import mock -+try: -+ import unittest.mock as mock -+except ImportError: -+ import mock - import pytest - - from urllib3 import HTTPConnectionPool -Index: urllib3-1.26.10/test/test_response.py -=================================================================== ---- urllib3-1.26.10.orig/test/test_response.py -+++ urllib3-1.26.10/test/test_response.py -@@ -9,7 +9,10 @@ from base64 import b64decode - from io import BufferedReader, BytesIO, TextIOWrapper - from test import onlyBrotlipy - --import mock -+try: -+ import unittest.mock as mock -+except ImportError: -+ import mock - import pytest - import six - -Index: urllib3-1.26.10/test/test_retry.py -=================================================================== ---- urllib3-1.26.10.orig/test/test_retry.py -+++ urllib3-1.26.10/test/test_retry.py -@@ -1,6 +1,9 @@ - import warnings - --import mock -+try: -+ import unittest.mock as mock -+except ImportError: -+ import mock - import pytest - - from urllib3.exceptions import ( -Index: urllib3-1.26.10/test/test_retry_deprecated.py -=================================================================== ---- urllib3-1.26.10.orig/test/test_retry_deprecated.py -+++ urllib3-1.26.10/test/test_retry_deprecated.py -@@ -1,7 +1,10 @@ - # This is a copy-paste of test_retry.py with extra asserts about deprecated options. It will be removed for v2. - import warnings - --import mock -+try: -+ import unittest.mock as mock -+except ImportError: -+ import mock - import pytest - - from urllib3.exceptions import ( -Index: urllib3-1.26.10/test/test_ssl.py -=================================================================== ---- urllib3-1.26.10.orig/test/test_ssl.py -+++ urllib3-1.26.10/test/test_ssl.py -@@ -1,6 +1,9 @@ - from test import notPyPy2 - --import mock -+try: -+ import unittest.mock as mock -+except ImportError: -+ import mock - import pytest - - from urllib3.exceptions import SNIMissingWarning -Index: urllib3-1.26.10/test/test_ssltransport.py -=================================================================== ---- urllib3-1.26.10.orig/test/test_ssltransport.py -+++ urllib3-1.26.10/test/test_ssltransport.py -@@ -4,7 +4,10 @@ import socket - import ssl - import sys - --import mock -+try: -+ import unittest.mock as mock -+except ImportError: -+ import mock - import pytest - - from dummyserver.server import DEFAULT_CA, DEFAULT_CERTS -Index: urllib3-1.26.10/test/test_util.py -=================================================================== ---- urllib3-1.26.10.orig/test/test_util.py -+++ urllib3-1.26.10/test/test_util.py -@@ -9,7 +9,10 @@ from itertools import chain - from test import notBrotlipy, onlyBrotlipy, onlyPy2, onlyPy3 - - import pytest --from mock import Mock, patch -+try: -+ from unittest.mock import Mock, patch -+except ImportError: -+ from mock import Mock, patch - - from urllib3 import add_stderr_logger, disable_warnings, util - from urllib3.exceptions import ( -Index: urllib3-1.26.10/test/with_dummyserver/test_connectionpool.py -=================================================================== ---- urllib3-1.26.10.orig/test/with_dummyserver/test_connectionpool.py -+++ urllib3-1.26.10/test/with_dummyserver/test_connectionpool.py -@@ -12,7 +12,10 @@ import warnings - from test import LONG_TIMEOUT, SHORT_TIMEOUT, onlyPy2 - from threading import Event - --import mock -+try: -+ import unittest.mock as mock -+except ImportError: -+ import mock - import pytest - import six - -Index: urllib3-1.26.10/test/with_dummyserver/test_https.py -=================================================================== ---- urllib3-1.26.10.orig/test/with_dummyserver/test_https.py -+++ urllib3-1.26.10/test/with_dummyserver/test_https.py -@@ -18,7 +18,10 @@ from test import ( - resolvesLocalhostFQDN, - ) - --import mock -+try: -+ import unittest.mock as mock -+except ImportError: -+ import mock - import pytest - import trustme - -Index: urllib3-1.26.10/test/with_dummyserver/test_socketlevel.py -=================================================================== ---- urllib3-1.26.10.orig/test/with_dummyserver/test_socketlevel.py -+++ urllib3-1.26.10/test/with_dummyserver/test_socketlevel.py -@@ -53,7 +53,10 @@ from test import ( - ) - from threading import Event - --import mock -+try: -+ import unittest.mock as mock -+except ImportError: -+ import mock - import pytest - import trustme - -Index: urllib3-1.26.10/test/test_poolmanager.py -=================================================================== ---- urllib3-1.26.10.orig/test/test_poolmanager.py -+++ urllib3-1.26.10/test/test_poolmanager.py -@@ -2,7 +2,11 @@ import socket - from test import resolvesLocalhostFQDN - - import pytest --from mock import patch -+ -+try: -+ import unittest.mock as mock -+except ImportError: -+ import mock - - from urllib3 import connection_from_url - from urllib3.exceptions import ClosedPoolError, LocationValueError -@@ -383,7 +387,7 @@ class TestPoolManager(object): - "http://[a::b%25zone]", - ], - ) -- @patch("urllib3.util.connection.create_connection") -+ @mock.patch("urllib3.util.connection.create_connection") - def test_e2e_connect_to_ipv6_scoped(self, create_connection, url): - """Checks that IPv6 scoped addresses are properly handled end-to-end. - diff --git a/urllib3-1.26.15.tar.gz b/urllib3-1.26.15.tar.gz deleted file mode 100644 index 119f6dd..0000000 --- a/urllib3-1.26.15.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8a388717b9476f934a21484e8c8e61875ab60644d29b9b39e11e4b9dc1c6b305 -size 301444 diff --git a/urllib3-2.0.2.tar.gz b/urllib3-2.0.2.tar.gz new file mode 100644 index 0000000..6febde8 --- /dev/null +++ b/urllib3-2.0.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61717a1095d7e155cdb737ac7bb2f4324a858a1e2e6466f6d03ff630ca68d3cc +size 277703