From f28e7e5f0fe7037039e4d8085bcac301e0029952 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Wed, 28 Jun 2017 14:08:56 +0200 Subject: [PATCH] minor fixes --- mitmproxy/proxy/protocol2/reverse_proxy.py | 5 +++-- mitmproxy/proxy/protocol2/tcp.py | 6 +----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/mitmproxy/proxy/protocol2/reverse_proxy.py b/mitmproxy/proxy/protocol2/reverse_proxy.py index eb7bd731f..a2c663382 100644 --- a/mitmproxy/proxy/protocol2/reverse_proxy.py +++ b/mitmproxy/proxy/protocol2/reverse_proxy.py @@ -3,6 +3,7 @@ from mitmproxy.proxy.protocol2.context import ClientServerContext, Context, Serv from mitmproxy.proxy.protocol2.events import Event from mitmproxy.proxy.protocol2.http import HTTPLayer from mitmproxy.proxy.protocol2.layer import Layer +from mitmproxy.proxy.protocol2.tcp import TCPLayer class ReverseProxy(Layer): @@ -11,8 +12,8 @@ class ReverseProxy(Layer): server = Server(server_addr) self.child_context = ClientServerContext(context.client, server) # self.child_layer = TLSLayer(self.child_context, True, True) - # self.child_layer = TCPLayer(self.child_context, True, True) - self.child_layer = HTTPLayer(self.child_context) + self.child_layer = TCPLayer(self.child_context, False) + # self.child_layer = HTTPLayer(self.child_context) def _handle_event(self, event: Event) -> TCommandGenerator: yield from self.child_layer.handle_event(event) diff --git a/mitmproxy/proxy/protocol2/tcp.py b/mitmproxy/proxy/protocol2/tcp.py index 7e19f015e..82062fc43 100644 --- a/mitmproxy/proxy/protocol2/tcp.py +++ b/mitmproxy/proxy/protocol2/tcp.py @@ -12,10 +12,6 @@ class TCPLayer(Layer): Simple TCP layer that just relays messages right now. """ context: ClientServerContext = None - - # this is like a mini state machine. - state: typing.Callable[[events.Event], commands.TCommandGenerator] - ignore: bool flow: tcp.TCPFlow @@ -67,4 +63,4 @@ class TCPLayer(Layer): @expect(events.DataReceived, events.ConnectionClosed) def done(self, _): - pass + yield from ()