View | Details | Raw Unified | Return to bug 276138 | Differences between
and this patch

Collapse All | Expand All

(-)b/www/py-httpbin/Makefile (-14 / +18 lines)
Lines 1-32 Link Here
1
PORTNAME=	httpbin
1
PORTNAME=	httpbin
2
PORTVERSION=	0.7.0
2
PORTVERSION=	0.10.1
3
PORTREVISION=	1
4
CATEGORIES=	www python
3
CATEGORIES=	www python
5
MASTER_SITES=	PYPI
4
MASTER_SITES=	PYPI
6
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
5
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
7
6
8
MAINTAINER=	contact@evilham.com
7
MAINTAINER=	contact@evilham.com
9
COMMENT=	HTTP Request & Response Service
8
COMMENT=	HTTP Request & Response Service
10
WWW=		https://github.com/postmanlabs/httpbin
9
WWW=		https://github.com/psf/httpbin
11
10
12
LICENSE=	ISCL
11
LICENSE=	ISCL
13
LICENSE_FILE=	${WRKSRC}/LICENSE
12
LICENSE_FILE=	${WRKSRC}/LICENSE
14
13
15
RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}blinker>=1.1:devel/py-blinker@${PY_FLAVOR} \
14
BUILD_DEPENDS=	${PY_SETUPTOOLS} \
16
		${PYTHON_PKGNAMEPREFIX}brotlipy>=0:archivers/py-brotlipy@${PY_FLAVOR} \
15
		${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR}
17
		${PYTHON_PKGNAMEPREFIX}decorator>=0:devel/py-decorator@${PY_FLAVOR} \
16
RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}flask>0:www/py-flask@${PY_FLAVOR} \
18
		${PYTHON_PKGNAMEPREFIX}markupsafe>=0:textproc/py-markupsafe@${PY_FLAVOR} \
17
		${PYTHON_PKGNAMEPREFIX}brotlicffi>0:archivers/py-brotlicffi@${PY_FLAVOR} \
19
		${PYTHON_PKGNAMEPREFIX}flask>=0:www/py-flask@${PY_FLAVOR} \
18
		${PYTHON_PKGNAMEPREFIX}decorator>0:devel/py-decorator@${PY_FLAVOR} \
20
		${PYTHON_PKGNAMEPREFIX}itsdangerous>=0:security/py-itsdangerous@${PY_FLAVOR} \
19
		${PYTHON_PKGNAMEPREFIX}flasgger>0:www/py-flasgger@${PY_FLAVOR} \
21
		${PYTHON_PKGNAMEPREFIX}raven>=0:devel/py-raven@${PY_FLAVOR} \
20
		${PYTHON_PKGNAMEPREFIX}greenlet>=3.0.0a1:devel/py-greenlet@${PY_FLAVOR} \
22
		${PYTHON_PKGNAMEPREFIX}werkzeug>=0.14.1:www/py-werkzeug@${PY_FLAVOR} \
21
		${PYTHON_PKGNAMEPREFIX}greenlet>=3.0:devel/py-greenlet@${PY_FLAVOR} \
23
		${PYTHON_PKGNAMEPREFIX}six>=0:devel/py-six@${PY_FLAVOR}
22
		${PYTHON_PKGNAMEPREFIX}importlib-metadata>=0:devel/py-importlib-metadata@${PY_FLAVOR} \
23
		${PYTHON_PKGNAMEPREFIX}six>0:devel/py-six@${PY_FLAVOR} \
24
		${PYTHON_PKGNAMEPREFIX}werkzeug>=0.14.1:www/py-werkzeug@${PY_FLAVOR}
24
25
25
USES=		python
26
USES=		python
26
USE_PYTHON=	autoplist concurrent distutils
27
USE_PYTHON=	pep517 autoplist pytest
28
29
TEST_ENV=	${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
30
27
NO_ARCH=	yes
31
NO_ARCH=	yes
28
32
29
do-test:
33
do-test:
30
	@cd ${WRKSRC} && ${PYTHON_CMD} test_httpbin.py
34
	@cd ${WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m unittest -v tests/test_httpbin.py
31
35
32
.include <bsd.port.mk>
36
.include <bsd.port.mk>
(-)b/www/py-httpbin/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1607953372
1
TIMESTAMP = 1704479732
2
SHA256 (httpbin-0.7.0.tar.gz) = cbb37790c91575f4f15757f42ad41d9f729eb227d5edbe89e4ec175486db8dfa
2
SHA256 (httpbin-0.10.1.tar.gz) = 7b8596beb0e75a7b653c39d1f3cf263d6d5c476d29e1df6f7bb2b70bf9f06a3d
3
SIZE (httpbin-0.7.0.tar.gz) = 92613
3
SIZE (httpbin-0.10.1.tar.gz) = 107058
(-)a/www/py-httpbin/files/patch-httpbin-core.py (-11 lines)
Removed Link Here
1
--- httpbin/core.py.orig	2018-05-08 11:41:03 UTC
2
+++ httpbin/core.py
3
@@ -19,7 +19,7 @@ from flask import Flask, Response, request, render_tem
4
 from six.moves import range as xrange
5
 from werkzeug.datastructures import WWWAuthenticate, MultiDict
6
 from werkzeug.http import http_date
7
-from werkzeug.wrappers import BaseResponse
8
+from werkzeug.wrappers import Response as BaseResponse
9
 from werkzeug.http import parse_authorization_header
10
 from raven.contrib.flask import Sentry
11
 
(-)b/www/py-httpbin/files/patch-httpbin_core.py (+40 lines)
Added Link Here
1
--- httpbin/core.py.orig	2023-08-28 22:56:17 UTC
2
+++ httpbin/core.py
3
@@ -32,7 +32,6 @@ except ImportError:  # werkzeug < 2.1
4
     from werkzeug.wrappers import Response
5
 except ImportError:  # werkzeug < 2.1
6
     from werkzeug.wrappers import BaseResponse as Response
7
-from werkzeug.http import parse_authorization_header
8
 from flasgger import Swagger, NO_SANITIZER
9
 
10
 from . import filters
11
@@ -47,6 +46,7 @@ from .helpers import (
12
     H,
13
     ROBOT_TXT,
14
     ANGRY_ASCII,
15
+    parse_authorization_header,
16
     parse_multi_value_header,
17
     next_stale_after_value,
18
     digest_challenge_response,
19
@@ -636,16 +636,17 @@ def redirect_to():
20
     args_dict = request.args.items()
21
     args = CaseInsensitiveDict(args_dict)
22
 
23
-    # We need to build the response manually and convert to UTF-8 to prevent
24
-    # werkzeug from "fixing" the URL. This endpoint should set the Location
25
-    # header to the exact string supplied.
26
+
27
+    # Can be removed when: https://github.com/psf/httpbin/issues/36 is closed
28
+    # See also:
29
+    # https://src.fedoraproject.org/rpms/python-httpbin/c/54fe8e1f94f208b16ef0588e4eb69aaa107e9867?branch=rawhide
30
     response = app.make_response("")
31
     response.status_code = 302
32
     if "status_code" in args:
33
         status_code = int(args["status_code"])
34
         if status_code >= 300 and status_code < 400:
35
             response.status_code = status_code
36
-    response.headers["Location"] = args["url"].encode("utf-8")
37
+    response.headers["Location"] = args["url"]
38
 
39
     return response
40
 
(-)b/www/py-httpbin/files/patch-httpbin_helpers.py (+41 lines)
Added Link Here
1
--- httpbin/helpers.py.orig	2023-08-28 22:56:17 UTC
2
+++ httpbin/helpers.py
3
@@ -13,7 +13,15 @@ from hashlib import md5, sha256, sha512
4
 import time
5
 import os
6
 from hashlib import md5, sha256, sha512
7
-from werkzeug.http import parse_authorization_header
8
+# Can be removed when: https://github.com/psf/httpbin/issues/36 is closed
9
+# See also (version order is wrong):
10
+# https://src.fedoraproject.org/rpms/python-httpbin/c/54fe8e1f94f208b16ef0588e4eb69aaa107e9867?branch=rawhide
11
+from werkzeug.http import dump_header
12
+try:
13
+    from werkzeug.datastructures import Authorization
14
+    parse_authorization_header = Authorization.from_header
15
+except ImportError: # werkzeug < 2.3
16
+    from werkzeug.http import parse_authorization_header
17
 from werkzeug.datastructures import WWWAuthenticate
18
 
19
 from flask import request, make_response
20
@@ -466,9 +474,17 @@ def digest_challenge_response(app, qop, algorithm, sta
21
     ]), algorithm)
22
     opaque = H(os.urandom(10), algorithm)
23
 
24
-    auth = WWWAuthenticate("digest")
25
-    auth.set_digest('me@kennethreitz.com', nonce, opaque=opaque,
26
-                    qop=('auth', 'auth-int') if qop is None else (qop,), algorithm=algorithm)
27
-    auth.stale = stale
28
+    # Can be removed when: https://github.com/psf/httpbin/issues/36 is closed
29
+    # See also:
30
+    # https://src.fedoraproject.org/rpms/python-httpbin/c/54fe8e1f94f208b16ef0588e4eb69aaa107e9867?branch=rawhide
31
+    values = {
32
+        'realm': 'me@kennethreitz.com',
33
+        'nonce': nonce,
34
+        'opaque': opaque,
35
+        'qop': dump_header(('auth', 'auth-int') if qop is None else (qop,)),
36
+        'algorithm': algorithm,
37
+        'stale': stale,
38
+    }
39
+    auth = WWWAuthenticate("digest", values=values) 
40
     response.headers['WWW-Authenticate'] = auth.to_header()
41
     return response
(-)a/www/py-httpbin/files/patch-test__httpbin.py (-24 lines)
Removed Link Here
1
--- test_httpbin.py.orig	2018-05-08 11:41:03 UTC
2
+++ test_httpbin.py
3
@@ -144,7 +144,9 @@ class HttpbinTestCase(unittest.TestCase):
4
         data = json.loads(response.data.decode('utf-8'))
5
         self.assertEqual(data['args'], {})
6
         self.assertEqual(data['headers']['Host'], 'localhost')
7
-        self.assertEqual(data['headers']['Content-Length'], '0')
8
+        # Newest Werkzeug versions omit Content-Length if '0'; see
9
+        # https://github.com/postmanlabs/httpbin/pull/555/files
10
+        self.assertEqual(data['headers'].get('Content-Length', '0'), '0')
11
         self.assertEqual(data['headers']['User-Agent'], 'test')
12
         # self.assertEqual(data['origin'], None)
13
         self.assertEqual(data['url'], 'http://localhost/get')
14
@@ -158,7 +160,9 @@ class HttpbinTestCase(unittest.TestCase):
15
         data = json.loads(response.data.decode('utf-8'))
16
         self.assertEqual(data['args'], {})
17
         self.assertEqual(data['headers']['Host'], 'localhost')
18
-        self.assertEqual(data['headers']['Content-Length'], '0')
19
+        # Newest Werkzeug versions omit Content-Length if '0'; see
20
+        # https://github.com/postmanlabs/httpbin/pull/555/files
21
+        self.assertEqual(data['headers'].get('Content-Length', '0'), '0')
22
         self.assertEqual(data['url'], 'http://localhost/anything/foo/bar')
23
         self.assertEqual(data['method'], 'GET')
24
         self.assertTrue(response.data.endswith(b'\n'))

Return to bug 276138