py-httpbin hasn't had an update since 2018 and appears abandoned upstream.
However it is still widely used in the ports tree.
In order to update werkzeug, something like the below is needed in
py-httpbin.
We don't need to add support for werkzeug older than 2.0 since we're
already at 2.0.3 in the ports tree, just need to stop using BaseResponse
and switch to using Response.
ok?
Index: Makefile
===================================================================
RCS file: /cvs/ports/www/py-httpbin/Makefile,v
retrieving revision 1.14
diff -u -p -u -r1.14 Makefile
--- Makefile 1 Dec 2022 16:53:19 -0000 1.14
+++ Makefile 24 Feb 2023 07:10:22 -0000
@@ -3,6 +3,7 @@ COMMENT = HTTP request and response ser
MODPY_EGG_VERSION = 0.7.0
DISTNAME = httpbin-${MODPY_EGG_VERSION}
PKGNAME = py-${DISTNAME}
+REVISION = 0
CATEGORIES = www
Index: patches/patch-httpbin_core_py
===================================================================
RCS file: /cvs/ports/www/py-httpbin/patches/patch-httpbin_core_py,v
retrieving revision 1.1
diff -u -p -u -r1.1 patch-httpbin_core_py
--- patches/patch-httpbin_core_py 1 Dec 2022 16:53:19 -0000 1.1
+++ patches/patch-httpbin_core_py 24 Feb 2023 07:10:22 -0000
@@ -1,15 +1,30 @@
+BaseResponse -> Response as of werkzeug 2.0
+
+see: https://github.com/postmanlabs/httpbin/pull/674
+
Index: httpbin/core.py
--- httpbin/core.py.orig
+++ httpbin/core.py
-@@ -21,7 +21,6 @@ from werkzeug.datastructures import WWWAuthenticate, M
+@@ -19,9 +19,8 @@ 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 BaseResponse
++from werkzeug.wrappers import Response as WzResponse
from werkzeug.http import parse_authorization_header
-from raven.contrib.flask import Sentry
from . import filters
from .helpers import get_headers, status_code, get_dict, get_request_range,
check_basic_auth, check_digest_auth, \
-@@ -55,10 +54,6 @@ tmpl_dir = os.path.join(os.path.dirname(os.path.abspat
+@@ -48,17 +47,13 @@ def jsonify(*args, **kwargs):
+ return response
+
+ # Prevent WSGI from correcting the casing of the Location header
+-BaseResponse.autocorrect_location_header = False
++WzResponse.autocorrect_location_header = False
+
+ # Find the correct template folder when running from a different location
+ tmpl_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'templates')
app = Flask(__name__, template_folder=tmpl_dir)
app.debug = bool(os.environ.get('DEBUG'))