diff --git a/libpathod/pathoc.py b/libpathod/pathoc.py index 4bfe7c7df..55c2a6e07 100644 --- a/libpathod/pathoc.py +++ b/libpathod/pathoc.py @@ -290,9 +290,9 @@ class Pathoc(tcp.TCPClient): self.sslinfo = None if self.ssl: try: - alpn_protos = [http.ALPN_PROTO_HTTP1] + alpn_protos = [b'http/1.1'] if self.use_http2: - alpn_protos.append(http.ALPN_PROTO_H2) + alpn_protos.append(b'h2') self.convert_to_ssl( sni=self.sni, @@ -424,7 +424,7 @@ class Pathoc(tcp.TCPClient): finally: if resp: lg("<< %s %s: %s bytes" % ( - resp.status_code, utils.xrepr(resp.msg), len(resp.body) + resp.status_code, utils.xrepr(resp.msg), len(resp.content) )) if resp.status_code in self.ignorecodes: lg.suppress() diff --git a/libpathod/pathod.py b/libpathod/pathod.py index 95fc6af24..55e75074f 100644 --- a/libpathod/pathod.py +++ b/libpathod/pathod.py @@ -41,7 +41,7 @@ class SSLOptions(object): ssl_options=tcp.SSL_DEFAULT_OPTIONS, ciphers=None, certs=None, - alpn_select=http.ALPN_PROTO_H2, + alpn_select=b'h2', ): self.confdir = confdir self.cn = cn @@ -140,7 +140,7 @@ class PathodHandler(tcp.BaseHandler): path = req.path http_version = req.http_version headers = req.headers - body = req.body + body = req.content clientcert = None if self.clientcert: @@ -259,7 +259,7 @@ class PathodHandler(tcp.BaseHandler): return alp = self.get_alpn_proto_negotiated() - if alp == http.ALPN_PROTO_H2: + if alp == b'h2': self.protocol = protocols.http2.HTTP2Protocol(self) self.use_http2 = True diff --git a/test/test_app.py b/test/test_app.py index 4571617ff..4536db8e7 100644 --- a/test/test_app.py +++ b/test/test_app.py @@ -7,7 +7,7 @@ class TestApp(tutils.DaemonTests): def test_index(self): r = self.getpath("/") assert r.status_code == 200 - assert r.body + assert r.content def test_about(self): r = self.getpath("/about") @@ -38,48 +38,48 @@ class TestApp(tutils.DaemonTests): def test_response_preview(self): r = self.getpath("/response_preview", params=dict(spec="200")) assert r.status_code == 200 - assert 'Response' in r.body + assert 'Response' in r.content r = self.getpath("/response_preview", params=dict(spec="foo")) assert r.status_code == 200 - assert 'Error' in r.body + assert 'Error' in r.content r = self.getpath("/response_preview", params=dict(spec="200:b@100m")) assert r.status_code == 200 - assert "too large" in r.body + assert "too large" in r.content r = self.getpath("/response_preview", params=dict(spec="200:b@5k")) assert r.status_code == 200 - assert 'Response' in r.body + assert 'Response' in r.content r = self.getpath( "/response_preview", params=dict( spec="200:b