From 23e295b37eb3aee9ebe7c88cc1ebb1dc2ffa9cf2 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Sun, 3 Jul 2016 19:04:16 +0200 Subject: py3: fix bytes vs. str --- netlib/http/http2/utils.py | 8 ++++---- pathod/protocols/http2.py | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/netlib/http/http2/utils.py b/netlib/http/http2/utils.py index 4d5f580c..4c01952d 100644 --- a/netlib/http/http2/utils.py +++ b/netlib/http/http2/utils.py @@ -2,10 +2,10 @@ from netlib.http import url def parse_headers(headers): - authority = headers.get(':authority', b'') - method = headers.get(':method', b'GET') - scheme = headers.get(':scheme', b'https') - path = headers.get(':path', b'/') + authority = headers.get(':authority', '').encode() + method = headers.get(':method', 'GET').encode() + scheme = headers.get(':scheme', 'https').encode() + path = headers.get(':path', '/').encode() headers.clear(":method") headers.clear(":scheme") diff --git a/pathod/protocols/http2.py b/pathod/protocols/http2.py index d94cd981..5ad120de 100644 --- a/pathod/protocols/http2.py +++ b/pathod/protocols/http2.py @@ -181,10 +181,10 @@ class HTTP2StateProtocol(object): headers = request.headers.copy() if ':authority' not in headers: - headers.insert(0, b':authority', authority.encode('ascii')) - headers.insert(0, b':scheme', request.scheme.encode('ascii')) - headers.insert(0, b':path', request.path.encode('ascii')) - headers.insert(0, b':method', request.method.encode('ascii')) + headers.insert(0, ':authority', authority) + headers.insert(0, ':scheme', request.scheme) + headers.insert(0, ':path', request.path) + headers.insert(0, ':method', request.method) if hasattr(request, 'stream_id'): stream_id = request.stream_id @@ -397,7 +397,7 @@ class HTTP2StateProtocol(object): self._handle_unexpected_frame(frm) headers = netlib.http.headers.Headers( - (k.encode('ascii'), v.encode('ascii')) for k, v in self.decoder.decode(header_blocks) + [[k, v] for k, v in self.decoder.decode(header_blocks, raw=True)] ) return stream_id, headers, body -- cgit v1.2.3