diff options
author | V3n3RiX <venerix@koprulu.sector> | 2023-11-03 21:56:14 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2023-11-03 21:56:14 +0000 |
commit | 9d352bec7c48de973d3fa345f92f733fe075f19a (patch) | |
tree | 64f90676327e8109f90198f42bb1f1784c68e969 /dev-python/httpbin | |
parent | 782ce86e028f083bc3ad28d3a1fd28a344f0413b (diff) |
gentoo auto-resync : 03:11:2023 - 21:56:13
Diffstat (limited to 'dev-python/httpbin')
-rw-r--r-- | dev-python/httpbin/Manifest | 2 | ||||
-rw-r--r-- | dev-python/httpbin/files/httpbin-0.10.1-werkzeug-3.patch | 78 | ||||
-rw-r--r-- | dev-python/httpbin/httpbin-0.10.1-r3.ebuild | 42 |
3 files changed, 122 insertions, 0 deletions
diff --git a/dev-python/httpbin/Manifest b/dev-python/httpbin/Manifest index 315a8c922399..331827b676ce 100644 --- a/dev-python/httpbin/Manifest +++ b/dev-python/httpbin/Manifest @@ -1,3 +1,5 @@ +AUX httpbin-0.10.1-werkzeug-3.patch 2753 BLAKE2B eb335f980867d0f55b4f790689b890c4c92246e870f3714fcda88ec302491ff76e6cc46929d227d0ef3b5b5682152d0ad83dd97e46a16729282de1497935c5e5 SHA512 b232558f609425f7cb674bf34fa0116c76e69d93ce52df656a4d76a7fec8e5a9d6f872abc681bbafede7aa5c7187439a695fbbf18ebc5c8271001bc7776a7fb7 DIST httpbin-0.10.1.tar.gz 107058 BLAKE2B a46732946fc3454e2ae71c4eec4f88521e190b736445c54f555021a273a75f57acbc9234237e6973a21fc3bf8f71d8c8b51d6422d719f03546ecd6887a20fe1b SHA512 e3b851253c347893a80e866e7d0188c572f2a87a540125de3d9cbe0b8c3f1ddfab2c60ee3ffde3fd7274fc662294c978c39b1b52acfd92c52fd552966da203be EBUILD httpbin-0.10.1-r2.ebuild 971 BLAKE2B 6ed086d061c422535938ff7102a0fd296a02fef8c268b270935cc2d99e53d98f5f9a32103a190e4d6afe3e16061c3b0a684a4a4e43bd94c3738524c3db626b0f SHA512 e3b46bed098b2f44b652df8a5923cbedc03c63a5f5b189638cc4967ea5321c0c24a1b2af598d85182750606885520f233479a9298e0f552e01deca88588c667d +EBUILD httpbin-0.10.1-r3.ebuild 1002 BLAKE2B f67db154cf86c694326c205cad17a29198ae1df14406b1ab8c2376c3ccb669f29feb3ee4cdab5e0f17ae3d522d1353450fb9c320f211afacf4e059e9a3211005 SHA512 81e687321bed70ac591b61eb7131d4b05da9c64b89e59e23861448e8f7abd29d45a5b2ac299dbf79a2ef5101c3c45d9ad65464a0956be9fa8ef5692fbb36fc8f MISC metadata.xml 445 BLAKE2B c577334830bc0d51f9df221e224c231c254b3db9129e4028d53cbd96a4481728e3b721b44f569c243deeecfb38e8dc81a7566a0b7ccd665d51b1a69a3687eb18 SHA512 fcdbd0c24e12d91df89af24befa6c9600f28083c3fe38e88ebec9856f4fb5c4c137c3b85f2271422c513bbd7c31a457f8290ebc2dd755d9117d57aa42883eec8 diff --git a/dev-python/httpbin/files/httpbin-0.10.1-werkzeug-3.patch b/dev-python/httpbin/files/httpbin-0.10.1-werkzeug-3.patch new file mode 100644 index 000000000000..5ad6f2743400 --- /dev/null +++ b/dev-python/httpbin/files/httpbin-0.10.1-werkzeug-3.patch @@ -0,0 +1,78 @@ +diff --git a/httpbin/core.py b/httpbin/core.py +index 5c1783a1..a82c1b88 100644 +--- a/httpbin/core.py ++++ b/httpbin/core.py +@@ -32,7 +32,7 @@ + from werkzeug.wrappers import Response + except ImportError: # werkzeug < 2.1 + from werkzeug.wrappers import BaseResponse as Response +-from werkzeug.http import parse_authorization_header ++ + from flasgger import Swagger, NO_SANITIZER + + from . import filters +@@ -47,6 +47,7 @@ + H, + ROBOT_TXT, + ANGRY_ASCII, ++ parse_authorization_header, + parse_multi_value_header, + next_stale_after_value, + digest_challenge_response, +@@ -636,16 +637,13 @@ def redirect_to(): + args_dict = request.args.items() + args = CaseInsensitiveDict(args_dict) + +- # We need to build the response manually and convert to UTF-8 to prevent +- # werkzeug from "fixing" the URL. This endpoint should set the Location +- # header to the exact string supplied. + response = app.make_response("") + response.status_code = 302 + if "status_code" in args: + status_code = int(args["status_code"]) + if status_code >= 300 and status_code < 400: + response.status_code = status_code +- response.headers["Location"] = args["url"].encode("utf-8") ++ response.headers["Location"] = args["url"] + + return response + +diff --git a/httpbin/helpers.py b/httpbin/helpers.py +index b29e1835..836c8026 100644 +--- a/httpbin/helpers.py ++++ b/httpbin/helpers.py +@@ -13,8 +13,14 @@ + import time + import os + from hashlib import md5, sha256, sha512 +-from werkzeug.http import parse_authorization_header + from werkzeug.datastructures import WWWAuthenticate ++from werkzeug.http import dump_header ++ ++try: ++ from werkzeug.http import parse_authorization_header ++except ImportError: # werkzeug < 2.3 ++ from werkzeug.datastructures import Authorization ++ parse_authorization_header = Authorization.from_header + + from flask import request, make_response + from six.moves.urllib.parse import urlparse, urlunparse +@@ -466,9 +472,14 @@ def digest_challenge_response(app, qop, algorithm, stale = False): + ]), algorithm) + opaque = H(os.urandom(10), algorithm) + +- auth = WWWAuthenticate("digest") +- auth.set_digest('me@kennethreitz.com', nonce, opaque=opaque, +- qop=('auth', 'auth-int') if qop is None else (qop,), algorithm=algorithm) +- auth.stale = stale ++ values = { ++ 'realm': 'me@kennethreitz.com', ++ 'nonce': nonce, ++ 'opaque': opaque, ++ 'qop': dump_header(('auth', 'auth-int') if qop is None else (qop,)), ++ 'algorithm': algorithm, ++ 'stale': stale, ++ } ++ auth = WWWAuthenticate("digest", values=values) + response.headers['WWW-Authenticate'] = auth.to_header() + return response diff --git a/dev-python/httpbin/httpbin-0.10.1-r3.ebuild b/dev-python/httpbin/httpbin-0.10.1-r3.ebuild new file mode 100644 index 000000000000..c8dd0484fecb --- /dev/null +++ b/dev-python/httpbin/httpbin-0.10.1-r3.ebuild @@ -0,0 +1,42 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{10..12} pypy3 ) + +inherit distutils-r1 pypi + +DESCRIPTION="HTTP Request and Response Service" +HOMEPAGE=" + https://github.com/psf/httpbin/ + https://pypi.org/project/httpbin/ +" + +LICENSE="|| ( MIT ISC )" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" + +RDEPEND=" + dev-python/brotlicffi[${PYTHON_USEDEP}] + dev-python/decorator[${PYTHON_USEDEP}] + dev-python/flasgger[${PYTHON_USEDEP}] + >=dev-python/flask-2.2.4[${PYTHON_USEDEP}] + dev-python/itsdangerous[${PYTHON_USEDEP}] + dev-python/markupsafe[${PYTHON_USEDEP}] + dev-python/six[${PYTHON_USEDEP}] +" + +distutils_enable_tests pytest + +src_prepare() { + local PATCHES=( + # https://github.com/psf/httpbin/pull/29 + "${FILESDIR}/${P}-werkzeug-3.patch" + ) + + # unpin greenlet + sed -i -e '/greenlet/d' pyproject.toml || die + distutils-r1_src_prepare +} |