diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-07-16 22:57:20 +0200 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-07-22 15:30:33 +0200 |
commit | 032f8b2985a7c5f89d2dde0992e4f356bf58fcaa (patch) | |
tree | fae83254eecac1e9f0469e306af999a687466033 /libpathod/pathoc.py | |
parent | 2b0465dbb93dd4bf0d6db366db597c05e92121d8 (diff) | |
download | mitmproxy-032f8b2985a7c5f89d2dde0992e4f356bf58fcaa.tar.gz mitmproxy-032f8b2985a7c5f89d2dde0992e4f356bf58fcaa.tar.bz2 mitmproxy-032f8b2985a7c5f89d2dde0992e4f356bf58fcaa.zip |
use common interface for HTTP/1 and HTTP/2
Diffstat (limited to 'libpathod/pathoc.py')
-rw-r--r-- | libpathod/pathoc.py | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/libpathod/pathoc.py b/libpathod/pathoc.py index 89b0e0c9..ba15e630 100644 --- a/libpathod/pathoc.py +++ b/libpathod/pathoc.py @@ -209,8 +209,7 @@ class Pathoc(tcp.TCPClient): ) self.protocol = http2.HTTP2Protocol(self, dump_frames=self.http2_framedump) else: - # TODO: create HTTP or Websockets protocol - self.protocol = None + self.protocol = http1.HTTP1Protocol(self) self.settings = language.Settings( is_client=True, @@ -409,16 +408,8 @@ class Pathoc(tcp.TCPClient): req = language.serve(r, self.wfile, self.settings) self.wfile.flush() - if self.use_http2: - status_code, headers, body = self.protocol.read_response() - resp = http.Response("HTTP/2", status_code, "", headers, body, self.sslinfo) - else: - resp = http.http1.read_response( - self.rfile, - req["method"], - None - ) - resp.sslinfo = self.sslinfo + resp = self.protocol.read_response(req["method"], None) + resp.sslinfo = self.sslinfo except http.HttpError as v: lg("Invalid server response: %s" % v) raise |