commit:     911e95c2d254ed5ac0780dc00efd6029594e9931
Author:     Piotr Karbowski <slashbeast <AT> gentoo <DOT> org>
AuthorDate: Tue May 16 21:07:56 2023 +0000
Commit:     Piotr Karbowski <slashbeast <AT> gentoo <DOT> org>
CommitDate: Tue May 16 21:08:49 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=911e95c2

net-misc/httpie: 3.2.1-r2 revbump with urllib3-2.x fixes.

Signed-off-by: Piotr Karbowski <slashbeast <AT> gentoo.org>

 net-misc/httpie/files/httpie-urllib3-2-fixes.patch | 57 ++++++++++++++++++++++
 net-misc/httpie/httpie-3.2.1-r2.ebuild             | 49 +++++++++++++++++++
 2 files changed, 106 insertions(+)

diff --git a/net-misc/httpie/files/httpie-urllib3-2-fixes.patch 
b/net-misc/httpie/files/httpie-urllib3-2-fixes.patch
new file mode 100644
index 000000000000..2c6c5d348171
--- /dev/null
+++ b/net-misc/httpie/files/httpie-urllib3-2-fixes.patch
@@ -0,0 +1,57 @@
+From f8bb34ebf97bf6a103a7d021b16059522d76d52d Mon Sep 17 00:00:00 2001
+From: Brendon Smith <b...@bws.bio>
+Date: Sat, 6 May 2023 16:24:26 -0400
+Subject: [PATCH] Fix `urllib3.util.ssl_.DEFAULT_CIPHERS` import
+
+---
+ httpie/cli/definition.py |  4 ++--
+ httpie/ssl_.py           | 15 ++++++++++-----
+ 2 files changed, 12 insertions(+), 7 deletions(-)
+
+diff --git a/httpie/cli/definition.py b/httpie/cli/definition.py
+index 0e5f91edf7..5e54d1c896 100644
+--- a/httpie/cli/definition.py
++++ b/httpie/cli/definition.py
+@@ -831,8 +831,8 @@ def format_auth_help(auth_plugins_mapping, *, 
isolation_mode: bool = False):
+     short_help='A string in the OpenSSL cipher list format.',
+     help=f"""
+ 
+-    A string in the OpenSSL cipher list format. By default, the following
+-    is used:
++    A string in the OpenSSL cipher list format. By default, the available
++    system ciphers will be used, which are:
+ 
+     {DEFAULT_SSL_CIPHERS}
+ 
+diff --git a/httpie/ssl_.py b/httpie/ssl_.py
+index b9438543eb..c8dba0ea8d 100644
+--- a/httpie/ssl_.py
++++ b/httpie/ssl_.py
+@@ -3,13 +3,9 @@
+ 
+ from httpie.adapters import HTTPAdapter
+ # noinspection PyPackageRequirements
+-from urllib3.util.ssl_ import (
+-    DEFAULT_CIPHERS, create_urllib3_context,
+-    resolve_ssl_version,
+-)
++from urllib3.util.ssl_ import create_urllib3_context, resolve_ssl_version
+ 
+ 
+-DEFAULT_SSL_CIPHERS = DEFAULT_CIPHERS
+ SSL_VERSION_ARG_MAPPING = {
+     'ssl2.3': 'PROTOCOL_SSLv23',
+     'ssl3': 'PROTOCOL_SSLv3',
+@@ -94,3 +90,12 @@ def _is_key_file_encrypted(key_file):
+                 return True
+ 
+     return False
++
++
++try:
++    from urllib3.util.ssl_ import DEFAULT_CIPHERS
++except ImportError:
++    _context = HTTPieHTTPSAdapter._create_ssl_context(verify=False)
++    DEFAULT_CIPHERS = ":".join([cipher["name"] for cipher in 
_context.get_ciphers()])
++
++DEFAULT_SSL_CIPHERS = DEFAULT_CIPHERS

diff --git a/net-misc/httpie/httpie-3.2.1-r2.ebuild 
b/net-misc/httpie/httpie-3.2.1-r2.ebuild
new file mode 100644
index 000000000000..c28c9e703420
--- /dev/null
+++ b/net-misc/httpie/httpie-3.2.1-r2.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+PYTHON_REQ_USE="ssl(+)"
+DISTUTILS_USE_PEP517=setuptools
+
+inherit bash-completion-r1 distutils-r1
+
+DESCRIPTION="Modern command line HTTP client"
+HOMEPAGE="https://httpie.io/ https://pypi.org/project/httpie/";
+SRC_URI="https://github.com/httpie/httpie/archive/${PV}.tar.gz -> 
${P}.gh.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="
+       dev-python/charset_normalizer[${PYTHON_USEDEP}]
+       dev-python/defusedxml[${PYTHON_USEDEP}]
+       dev-python/pygments[${PYTHON_USEDEP}]
+       dev-python/multidict[${PYTHON_USEDEP}]
+       dev-python/rich[${PYTHON_USEDEP}]
+       >=dev-python/requests-2.22.0[${PYTHON_USEDEP}]
+       >=dev-python/requests-toolbelt-0.9.1[${PYTHON_USEDEP}]
+"
+BDEPEND="
+       test? (
+               ${RDEPEND}
+               dev-python/pyopenssl[${PYTHON_USEDEP}]
+               dev-python/pytest-httpbin[${PYTHON_USEDEP}]
+               dev-python/responses[${PYTHON_USEDEP}]
+       )
+"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-urllib3-2-fixes.patch"
+)
+
+distutils_enable_tests pytest
+
+python_install_all() {
+       newbashcomp extras/httpie-completion.bash http
+       insinto /usr/share/fish/vendor_completions.d
+       newins extras/httpie-completion.fish http.fish
+       distutils-r1_python_install_all
+}

Reply via email to