From 72cb84b2af94c333666b709b58dadad61f3567b2 Mon Sep 17 00:00:00 2001 From: Cheng Xingzhi Date: Fri, 12 Apr 2019 09:40:28 +0800 Subject: [PATCH 1/2] python3 compatibility fix for FakeOriginalResponse --- hyper/contrib.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hyper/contrib.py b/hyper/contrib.py index 79aa7d12..736dc367 100644 --- a/hyper/contrib.py +++ b/hyper/contrib.py @@ -180,8 +180,8 @@ def get_all(self, name, default=None): values = [] for n, v in self._headers: - if n == name.lower(): - values.append(v) + if n.decode('utf-8') == name.lower(): + values.append(v.decode('utf-8')) if not values: return default @@ -195,7 +195,7 @@ def getheaders(self, name): orig.version = 20 orig.status = resp.status orig.reason = resp.reason - orig.msg = FakeOriginalResponse(resp.headers.iter_raw()) + orig.msg = FakeOriginalResponse(list(resp.headers.iter_raw())) return response @@ -203,3 +203,4 @@ def close(self): for connection in self.connections.values(): connection.close() self.connections.clear() + From aaa6344a3a72f99e22ccd8eea55e1d55dfd7a091 Mon Sep 17 00:00:00 2001 From: Cheng Xingzhi Date: Wed, 11 Nov 2020 04:57:20 +0000 Subject: [PATCH 2/2] fix commas in :path --- hyper/common/headers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hyper/common/headers.py b/hyper/common/headers.py index 655a591a..5edb2332 100644 --- a/hyper/common/headers.py +++ b/hyper/common/headers.py @@ -242,7 +242,7 @@ def canonical_form(k, v): canonical form. This means that the header is split on commas unless for any reason it's a super-special snowflake (I'm looking at you Set-Cookie). """ - SPECIAL_SNOWFLAKES = set([b'set-cookie', b'set-cookie2']) + SPECIAL_SNOWFLAKES = set([b'set-cookie', b'set-cookie2', b':path']) k = k.lower()