diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2016-02-01 23:03:15 +0100 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2016-02-04 09:52:28 +0100 |
commit | d8ae7c3e29bcf117eb051f9e74b76fea733c1c64 (patch) | |
tree | 61d5f26362a80a84aee92f4fb41d1061ca829f75 /libmproxy | |
parent | f2097b47ce6c88e2bef0889fb7e7d52b63158082 (diff) | |
download | mitmproxy-d8ae7c3e29bcf117eb051f9e74b76fea733c1c64.tar.gz mitmproxy-d8ae7c3e29bcf117eb051f9e74b76fea733c1c64.tar.bz2 mitmproxy-d8ae7c3e29bcf117eb051f9e74b76fea733c1c64.zip |
fix tests and use netlib utils
Diffstat (limited to 'libmproxy')
-rw-r--r-- | libmproxy/protocol/http2.py | 3 | ||||
-rw-r--r-- | libmproxy/utils.py | 11 |
2 files changed, 2 insertions, 12 deletions
diff --git a/libmproxy/protocol/http2.py b/libmproxy/protocol/http2.py index 5c4586de..4b582f51 100644 --- a/libmproxy/protocol/http2.py +++ b/libmproxy/protocol/http2.py @@ -7,6 +7,7 @@ import Queue from netlib.tcp import ssl_read_select from netlib.exceptions import HttpException from netlib.http import Headers +from netlib.utils import http2_read_raw_frame import h2 from h2.connection import H2Connection @@ -212,7 +213,7 @@ class Http2Layer(Layer): with source_conn.h2.lock: try: - raw_frame = utils.http2_read_frame(source_conn.rfile) + raw_frame = b''.join(http2_read_raw_frame(source_conn.rfile)) except: for stream in self.streams.values(): stream.zombie = time.time() diff --git a/libmproxy/utils.py b/libmproxy/utils.py index 5b1c41f1..a697a637 100644 --- a/libmproxy/utils.py +++ b/libmproxy/utils.py @@ -173,14 +173,3 @@ def safe_subn(pattern, repl, target, *args, **kwargs): need a better solution that is aware of the actual content ecoding. """ return re.subn(str(pattern), str(repl), target, *args, **kwargs) - - -def http2_read_frame(rfile): - field = rfile.peek(3) - length = int(field.encode('hex'), 16) - - if length == 4740180: - raise ValueError("Probably not the correct length bytes: %s" % rfile.peek(20)) - - raw_frame = rfile.safe_read(9 + length) - return raw_frame |