From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id E8D4E15808B for ; Fri, 16 Feb 2024 17:16:50 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 35B30E2A04; Fri, 16 Feb 2024 17:16:49 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0E410E2A01 for ; Fri, 16 Feb 2024 17:16:49 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 0398133C1EB for ; Fri, 16 Feb 2024 17:16:48 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6042314B7 for ; Fri, 16 Feb 2024 17:16:46 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1708103752.c886664d717e65f9496d9fdb31e71f89d4ad5e98.mgorny@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/urllib3/, dev-python/urllib3/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-python/urllib3/files/urllib3-2.2.0-revert.patch dev-python/urllib3/urllib3-2.2.0-r1.ebuild dev-python/urllib3/urllib3-2.2.0.ebuild X-VCS-Directories: dev-python/urllib3/files/ dev-python/urllib3/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: c886664d717e65f9496d9fdb31e71f89d4ad5e98 X-VCS-Branch: master Date: Fri, 16 Feb 2024 17:16:46 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 5be1d2b2-7d92-4446-9b17-34ba6b5925f1 X-Archives-Hash: 2383286047ed64b1588455c01a4af1fe commit: c886664d717e65f9496d9fdb31e71f89d4ad5e98 Author: Michał Górny gentoo org> AuthorDate: Fri Feb 16 17:05:00 2024 +0000 Commit: Michał Górny gentoo org> CommitDate: Fri Feb 16 17:15:52 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c886664d dev-python/urllib3: Backport an upstream revert to fix regressions Closes: https://bugs.gentoo.org/924333 Signed-off-by: Michał Górny gentoo.org> .../urllib3/files/urllib3-2.2.0-revert.patch | 42 ++++++++++++++++++++++ ...rllib3-2.2.0.ebuild => urllib3-2.2.0-r1.ebuild} | 5 +++ 2 files changed, 47 insertions(+) diff --git a/dev-python/urllib3/files/urllib3-2.2.0-revert.patch b/dev-python/urllib3/files/urllib3-2.2.0-revert.patch new file mode 100644 index 000000000000..14175ecec58b --- /dev/null +++ b/dev-python/urllib3/files/urllib3-2.2.0-revert.patch @@ -0,0 +1,42 @@ +From 49b2ddaf07ec9ef65ef12d0218117f20e739ee6e Mon Sep 17 00:00:00 2001 +From: Quentin Pradet +Date: Fri, 16 Feb 2024 11:35:30 +0400 +Subject: [PATCH] Stop casting request headers to HTTPHeaderDict (#3344) + +While this was done to fix a mypy error, we did not notice the +consequences: + + * This breaks boto3 that subclasses HTTPConnection because + HTTPHeaderDict does not support bytes values yet. + * When proxying, headers are still a dictionary by default. + +We can decide to reintroduce a forced conversion to HTTPHeaderDict in +urllib3 3.0 if the above issues are fixed. +--- + changelog/3343.bugfix.rst | 1 + + src/urllib3/connectionpool.py | 4 ++-- + 2 files changed, 3 insertions(+), 2 deletions(-) + create mode 100644 changelog/3343.bugfix.rst + +diff --git a/changelog/3343.bugfix.rst b/changelog/3343.bugfix.rst +new file mode 100644 +index 0000000000..4f2df9e7a4 +--- /dev/null ++++ b/changelog/3343.bugfix.rst +@@ -0,0 +1 @@ ++Fixed ``HTTPConnectionPool.urlopen`` to stop automatically casting non-proxy headers to ``HTTPHeaderDict``. This change was premature as it did not apply to proxy headers and ``HTTPHeaderDict`` does not handle byte header values correctly yet. +diff --git a/src/urllib3/connectionpool.py b/src/urllib3/connectionpool.py +index 1036f0d718..bd58ff14dd 100644 +--- a/src/urllib3/connectionpool.py ++++ b/src/urllib3/connectionpool.py +@@ -751,8 +751,8 @@ def urlopen( # type: ignore[override] + # have to copy the headers dict so we can safely change it without those + # changes being reflected in anyone else's copy. + if not http_tunnel_required: +- headers = HTTPHeaderDict(headers) +- headers.update(self.proxy_headers) ++ headers = headers.copy() # type: ignore[attr-defined] ++ headers.update(self.proxy_headers) # type: ignore[union-attr] + + # Must keep the exception bound to a separate variable or else Python 3 + # complains about UnboundLocalError. diff --git a/dev-python/urllib3/urllib3-2.2.0.ebuild b/dev-python/urllib3/urllib3-2.2.0-r1.ebuild similarity index 95% rename from dev-python/urllib3/urllib3-2.2.0.ebuild rename to dev-python/urllib3/urllib3-2.2.0-r1.ebuild index eb55415eb52a..bdcc50c7b073 100644 --- a/dev-python/urllib3/urllib3-2.2.0.ebuild +++ b/dev-python/urllib3/urllib3-2.2.0-r1.ebuild @@ -66,6 +66,11 @@ BDEPEND=" " src_prepare() { + local PATCHES=( + # https://github.com/urllib3/urllib3/commit/49b2ddaf07ec9ef65ef12d0218117f20e739ee6e + "${FILESDIR}/${P}-revert.patch" + ) + # upstream considers 0.5 s to be "long" for a timeout # we get tons of test failures on *fast* systems because of that sed -i -e '/LONG_TIMEOUT/s:0.5:5:' test/__init__.py || die