Skip to content
This repository has been archived by the owner on Jan 13, 2021. It is now read-only.

python3 compatibility fix for FakeOriginalResponse #405

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hyper/common/headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
7 changes: 4 additions & 3 deletions hyper/contrib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -195,11 +195,12 @@ 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

def close(self):
for connection in self.connections.values():
connection.close()
self.connections.clear()