fix #1148: redirect() and non-ascii characters

Signed-off-by: zhang-liang-pengkun <zhangliangpengkun@xfusion.com>
This commit is contained in:
zhang-liang-pengkun 2023-12-21 10:33:44 +08:00
parent b073ca9815
commit 94b77f6e87
2 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,41 @@
From 4e96226db168e523030fde518caebd744952f8a5 Mon Sep 17 00:00:00 2001
From: Marcel Hellkamp <marc@gsites.de>
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

View File

@ -1,6 +1,6 @@
Name: python-bottle
Version: 0.12.13
Release: 13
Release: 14
Summary: WSGI micro web-framework for Python.
License: MIT
URL: http://bottlepy.org
@ -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: python2-devel python2-setuptools python3-devel python3-setuptools
@ -66,6 +67,9 @@ sed -i '/^#!/d' bottle.py
%{python3_sitelib}/*
%changelog
* Thu Dec 21 2023 zhangliangpengkun<zhangliangpengkun@xfusion.com> - 0.12.13-14
- fix #1148: redirect() and non-ascii characters
* Tue Dec 05 2023 zhangliangpengkun<zhangliangpengkun@xfusion.com> - 0.12.13-13
- fix #1115: Some modules set __file__ as None