42 lines
1.5 KiB
Diff
42 lines
1.5 KiB
Diff
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
|
|
|