diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2016-01-27 12:52:18 +0100 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2016-02-04 09:52:28 +0100 |
commit | 6d3b3994e27b3cd97c74612bc64c7e0457aeb448 (patch) | |
tree | 2dcdd32b653f6a100e47861dc296e60efeeca90e /libmproxy/protocol | |
parent | 64978968f2383988511dc7021ecd9892f098f723 (diff) | |
download | mitmproxy-6d3b3994e27b3cd97c74612bc64c7e0457aeb448.tar.gz mitmproxy-6d3b3994e27b3cd97c74612bc64c7e0457aeb448.tar.bz2 mitmproxy-6d3b3994e27b3cd97c74612bc64c7e0457aeb448.zip |
code formatting
Diffstat (limited to 'libmproxy/protocol')
-rw-r--r-- | libmproxy/protocol/http.py | 4 | ||||
-rw-r--r-- | libmproxy/protocol/http1.py | 7 | ||||
-rw-r--r-- | libmproxy/protocol/http2.py | 10 |
3 files changed, 11 insertions, 10 deletions
diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py index ee9d2d46..6a669ae1 100644 --- a/libmproxy/protocol/http.py +++ b/libmproxy/protocol/http.py @@ -23,7 +23,9 @@ from ..models import ( from .base import Layer, Kill + class _HttpTransmissionLayer(Layer): + def read_request(self): raise NotImplementedError() @@ -233,7 +235,7 @@ class HttpLayer(Layer): try: response = make_error_response(code, message) self.send_response(response) - except NetlibException, H2Error: + except NetlibException as H2Error: pass def change_upstream_proxy_server(self, address): diff --git a/libmproxy/protocol/http1.py b/libmproxy/protocol/http1.py index 0d6095df..fc2cf07a 100644 --- a/libmproxy/protocol/http1.py +++ b/libmproxy/protocol/http1.py @@ -1,12 +1,6 @@ from __future__ import (absolute_import, print_function, division) -import sys -import traceback import six -import struct -import threading -import time -import Queue from netlib import tcp from netlib.http import http1 @@ -17,6 +11,7 @@ from ..models import HTTPRequest, HTTPResponse class Http1Layer(_HttpTransmissionLayer): + def __init__(self, ctx, mode): super(Http1Layer, self).__init__(ctx) self.mode = mode diff --git a/libmproxy/protocol/http2.py b/libmproxy/protocol/http2.py index 423c5caa..5c4586de 100644 --- a/libmproxy/protocol/http2.py +++ b/libmproxy/protocol/http2.py @@ -1,6 +1,5 @@ from __future__ import (absolute_import, print_function, division) -import struct import threading import time import Queue @@ -17,9 +16,12 @@ from .base import Layer from .http import _HttpTransmissionLayer, HttpLayer from .. import utils from ..models import HTTPRequest, HTTPResponse -from ..exceptions import HttpProtocolException, ProtocolException +from ..exceptions import HttpProtocolException +from ..exceptions import ProtocolException + class SafeH2Connection(H2Connection): + def __init__(self, conn, *args, **kwargs): super(SafeH2Connection, self).__init__(*args, **kwargs) self.conn = conn @@ -71,7 +73,7 @@ class SafeH2Connection(H2Connection): if is_zombie(self, stream_id): return max_outbound_frame_size = self.max_outbound_frame_size - frame_chunk = chunk[position:position+max_outbound_frame_size] + frame_chunk = chunk[position:position + max_outbound_frame_size] if self.local_flow_control_window(stream_id) < len(frame_chunk): self.lock.release() time.sleep(0) @@ -88,6 +90,7 @@ class SafeH2Connection(H2Connection): class Http2Layer(Layer): + def __init__(self, ctx, mode): super(Http2Layer, self).__init__(ctx) self.mode = mode @@ -226,6 +229,7 @@ class Http2Layer(Layer): class Http2SingleStreamLayer(_HttpTransmissionLayer, threading.Thread): + def __init__(self, ctx, stream_id, request_headers): super(Http2SingleStreamLayer, self).__init__(ctx) self.zombie = None |