minor fixes

This commit is contained in:
Maximilian Hils 2017-06-28 14:08:56 +02:00
parent 35475f6719
commit f28e7e5f0f
2 changed files with 4 additions and 7 deletions

View File

@ -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)

View File

@ -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 ()