From 7429d4ea6cec5a6dfa2640639ca7c4c1e7f20d77 Mon Sep 17 00:00:00 2001 From: zhang-liang-pengkun Date: Thu, 21 Dec 2023 10:36:12 +0800 Subject: [PATCH] fix #1148: redirect() and non-ascii characters Signed-off-by: zhang-liang-pengkun --- ...48-redirect-and-non-ascii-characters.patch | 41 +++++++++++++++++++ python-bottle.spec | 6 ++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 0005-fix-1148-redirect-and-non-ascii-characters.patch diff --git a/0005-fix-1148-redirect-and-non-ascii-characters.patch b/0005-fix-1148-redirect-and-non-ascii-characters.patch new file mode 100644 index 0000000..c294fc4 --- /dev/null +++ b/0005-fix-1148-redirect-and-non-ascii-characters.patch @@ -0,0 +1,41 @@ +From 4e96226db168e523030fde518caebd744952f8a5 Mon Sep 17 00:00:00 2001 +From: Marcel Hellkamp +Date: Thu, 20 Jun 2019 12:46:23 +0200 +Subject: [PATCH] fix #1148: redirect() and non-ascii characters + +Backported from master +--- + bottle.py | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/bottle.py b/bottle.py +index 5887109..3c83650 100644 +--- a/bottle.py ++++ b/bottle.py +@@ -1557,7 +1557,7 @@ class BaseResponse(object): + + @property + def headerlist(self): +- ''' WSGI conform list of (header, value) tuples. ''' ++ """ WSGI conform list of (header, value) tuples. """ + out = [] + headers = list(self._headers.items()) + if 'Content-Type' not in self._headers: +@@ -1565,10 +1565,12 @@ class BaseResponse(object): + if self._status_code in self.bad_headers: + bad_headers = self.bad_headers[self._status_code] + headers = [h for h in headers if h[0] not in bad_headers] +- out += [(name, val) for name, vals in headers for val in vals] ++ out += [(name, val) for (name, vals) in headers for val in vals] + if self._cookies: + for c in self._cookies.values(): +- out.append(('Set-Cookie', c.OutputString())) ++ out.append(('Set-Cookie', _hval(c.OutputString()))) ++ if py3k: ++ out = [(k, v.encode('utf8').decode('latin1')) for (k, v) in out] + return out + + content_type = HeaderProperty('Content-Type') +-- +2.39.0.windows.2 + diff --git a/python-bottle.spec b/python-bottle.spec index b68d3ba..086c3ad 100644 --- a/python-bottle.spec +++ b/python-bottle.spec @@ -1,6 +1,6 @@ Name: python-bottle Version: 0.12.13 -Release: 14 +Release: 15 Summary: WSGI micro web-framework for Python. License: MIT URL: https://github.com/bottlepy/bottle @@ -12,6 +12,7 @@ Patch0002: 0001-fix-1065-gevent-1.3.0-removes-fast-wsgi-implementati.patch Patch0003: 0002-Fix-930-DeprecationWarning-Flags-not-at-the-start-of.patch Patch0004: 0003-Added-Python-3.4-3.7-language-classifiers.patch Patch0005: 0004-fix-1115-Some-modules-set-__file__-as-None.patch +Patch0006: 0005-fix-1148-redirect-and-non-ascii-characters.patch BuildArch: noarch BuildRequires: python3-devel python3-setuptools @@ -49,6 +50,9 @@ sed -i '/^#!/d' bottle.py %exclude %{_bindir}/bottle.py %changelog +* Wed Dec 20 2023 zhangliangpengkun - 0.12.13-15 +- fix #1148: redirect() and non-ascii characters + * Tue Dec 05 2023 zhangliangpengkun - 0.12.13-14 - fix #1115: Some modules set __file__ as None -- Gitee