mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 17:59:20 -04:00
www/py-httpbin: update 0.7.0 → 0.10.1
PR: 276138
This commit is contained in:
parent
7c58302b41
commit
c9938cd6a3
6 changed files with 102 additions and 52 deletions
|
@ -1,32 +1,36 @@
|
|||
PORTNAME= httpbin
|
||||
PORTVERSION= 0.7.0
|
||||
PORTREVISION= 1
|
||||
PORTVERSION= 0.10.1
|
||||
CATEGORIES= www python
|
||||
MASTER_SITES= PYPI
|
||||
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
|
||||
|
||||
MAINTAINER= contact@evilham.com
|
||||
COMMENT= HTTP Request & Response Service
|
||||
WWW= https://github.com/postmanlabs/httpbin
|
||||
WWW= https://github.com/psf/httpbin
|
||||
|
||||
LICENSE= ISCL
|
||||
LICENSE_FILE= ${WRKSRC}/LICENSE
|
||||
|
||||
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}blinker>=1.1:devel/py-blinker@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}brotlipy>=0:archivers/py-brotlipy@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}decorator>=0:devel/py-decorator@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}markupsafe>=0:textproc/py-markupsafe@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}flask>=0:www/py-flask@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}itsdangerous>=0:security/py-itsdangerous@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}raven>=0:devel/py-raven@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}werkzeug>=0.14.1:www/py-werkzeug@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}six>=0:devel/py-six@${PY_FLAVOR}
|
||||
BUILD_DEPENDS= ${PY_SETUPTOOLS} \
|
||||
${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR}
|
||||
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}flask>0:www/py-flask@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}brotlicffi>0:archivers/py-brotlicffi@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}decorator>0:devel/py-decorator@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}flasgger>0:www/py-flasgger@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}greenlet>=3.0.0a1:devel/py-greenlet@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}greenlet>=3.0:devel/py-greenlet@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}importlib-metadata>=0:devel/py-importlib-metadata@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}six>0:devel/py-six@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}werkzeug>=0.14.1:www/py-werkzeug@${PY_FLAVOR}
|
||||
|
||||
USES= python
|
||||
USE_PYTHON= autoplist concurrent distutils
|
||||
USE_PYTHON= pep517 autoplist pytest
|
||||
|
||||
TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
|
||||
|
||||
NO_ARCH= yes
|
||||
|
||||
do-test:
|
||||
@cd ${WRKSRC} && ${PYTHON_CMD} test_httpbin.py
|
||||
@cd ${WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m unittest -v tests/test_httpbin.py
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TIMESTAMP = 1607953372
|
||||
SHA256 (httpbin-0.7.0.tar.gz) = cbb37790c91575f4f15757f42ad41d9f729eb227d5edbe89e4ec175486db8dfa
|
||||
SIZE (httpbin-0.7.0.tar.gz) = 92613
|
||||
TIMESTAMP = 1704479732
|
||||
SHA256 (httpbin-0.10.1.tar.gz) = 7b8596beb0e75a7b653c39d1f3cf263d6d5c476d29e1df6f7bb2b70bf9f06a3d
|
||||
SIZE (httpbin-0.10.1.tar.gz) = 107058
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
--- httpbin/core.py.orig 2018-05-08 11:41:03 UTC
|
||||
+++ httpbin/core.py
|
||||
@@ -19,7 +19,7 @@ from flask import Flask, Response, request, render_tem
|
||||
from six.moves import range as xrange
|
||||
from werkzeug.datastructures import WWWAuthenticate, MultiDict
|
||||
from werkzeug.http import http_date
|
||||
-from werkzeug.wrappers import BaseResponse
|
||||
+from werkzeug.wrappers import Response as BaseResponse
|
||||
from werkzeug.http import parse_authorization_header
|
||||
from raven.contrib.flask import Sentry
|
||||
|
40
www/py-httpbin/files/patch-httpbin_core.py
Normal file
40
www/py-httpbin/files/patch-httpbin_core.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
--- httpbin/core.py.orig 2023-08-28 22:56:17 UTC
|
||||
+++ httpbin/core.py
|
||||
@@ -32,7 +32,6 @@ except ImportError: # werkzeug < 2.1
|
||||
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 +46,7 @@ from .helpers import (
|
||||
H,
|
||||
ROBOT_TXT,
|
||||
ANGRY_ASCII,
|
||||
+ parse_authorization_header,
|
||||
parse_multi_value_header,
|
||||
next_stale_after_value,
|
||||
digest_challenge_response,
|
||||
@@ -636,16 +636,17 @@ 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.
|
||||
+
|
||||
+ # Can be removed when: https://github.com/psf/httpbin/issues/36 is closed
|
||||
+ # See also:
|
||||
+ # https://src.fedoraproject.org/rpms/python-httpbin/c/54fe8e1f94f208b16ef0588e4eb69aaa107e9867?branch=rawhide
|
||||
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
|
||||
|
41
www/py-httpbin/files/patch-httpbin_helpers.py
Normal file
41
www/py-httpbin/files/patch-httpbin_helpers.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
--- httpbin/helpers.py.orig 2023-08-28 22:56:17 UTC
|
||||
+++ httpbin/helpers.py
|
||||
@@ -13,7 +13,15 @@ from hashlib import md5, sha256, sha512
|
||||
import time
|
||||
import os
|
||||
from hashlib import md5, sha256, sha512
|
||||
-from werkzeug.http import parse_authorization_header
|
||||
+# Can be removed when: https://github.com/psf/httpbin/issues/36 is closed
|
||||
+# See also (version order is wrong):
|
||||
+# https://src.fedoraproject.org/rpms/python-httpbin/c/54fe8e1f94f208b16ef0588e4eb69aaa107e9867?branch=rawhide
|
||||
+from werkzeug.http import dump_header
|
||||
+try:
|
||||
+ from werkzeug.datastructures import Authorization
|
||||
+ parse_authorization_header = Authorization.from_header
|
||||
+except ImportError: # werkzeug < 2.3
|
||||
+ from werkzeug.http import parse_authorization_header
|
||||
from werkzeug.datastructures import WWWAuthenticate
|
||||
|
||||
from flask import request, make_response
|
||||
@@ -466,9 +474,17 @@ def digest_challenge_response(app, qop, algorithm, sta
|
||||
]), 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
|
||||
+ # Can be removed when: https://github.com/psf/httpbin/issues/36 is closed
|
||||
+ # See also:
|
||||
+ # https://src.fedoraproject.org/rpms/python-httpbin/c/54fe8e1f94f208b16ef0588e4eb69aaa107e9867?branch=rawhide
|
||||
+ 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
|
|
@ -1,24 +0,0 @@
|
|||
--- test_httpbin.py.orig 2018-05-08 11:41:03 UTC
|
||||
+++ test_httpbin.py
|
||||
@@ -144,7 +144,9 @@ class HttpbinTestCase(unittest.TestCase):
|
||||
data = json.loads(response.data.decode('utf-8'))
|
||||
self.assertEqual(data['args'], {})
|
||||
self.assertEqual(data['headers']['Host'], 'localhost')
|
||||
- self.assertEqual(data['headers']['Content-Length'], '0')
|
||||
+ # Newest Werkzeug versions omit Content-Length if '0'; see
|
||||
+ # https://github.com/postmanlabs/httpbin/pull/555/files
|
||||
+ self.assertEqual(data['headers'].get('Content-Length', '0'), '0')
|
||||
self.assertEqual(data['headers']['User-Agent'], 'test')
|
||||
# self.assertEqual(data['origin'], None)
|
||||
self.assertEqual(data['url'], 'http://localhost/get')
|
||||
@@ -158,7 +160,9 @@ class HttpbinTestCase(unittest.TestCase):
|
||||
data = json.loads(response.data.decode('utf-8'))
|
||||
self.assertEqual(data['args'], {})
|
||||
self.assertEqual(data['headers']['Host'], 'localhost')
|
||||
- self.assertEqual(data['headers']['Content-Length'], '0')
|
||||
+ # Newest Werkzeug versions omit Content-Length if '0'; see
|
||||
+ # https://github.com/postmanlabs/httpbin/pull/555/files
|
||||
+ self.assertEqual(data['headers'].get('Content-Length', '0'), '0')
|
||||
self.assertEqual(data['url'], 'http://localhost/anything/foo/bar')
|
||||
self.assertEqual(data['method'], 'GET')
|
||||
self.assertTrue(response.data.endswith(b'\n'))
|
Loading…
Add table
Reference in a new issue