diff options
Diffstat (limited to 'libmproxy/protocol/__init__.py')
-rw-r--r-- | libmproxy/protocol/__init__.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libmproxy/protocol/__init__.py b/libmproxy/protocol/__init__.py index 5419c5ef..5e11e750 100644 --- a/libmproxy/protocol/__init__.py +++ b/libmproxy/protocol/__init__.py @@ -12,6 +12,7 @@ class ConnectionTypeChange(Exception): class ProtocolHandler(object): def __init__(self, c): self.c = c + """@type : libmproxy.proxy.ConnectionHandler""" def handle_messages(self): """ @@ -27,13 +28,17 @@ class ProtocolHandler(object): """ raise NotImplementedError +from . import http, tcp -from .http import HTTPHandler +protocols = dict( + http = dict(handler=http.HTTPHandler, flow=http.HTTPFlow), + tcp = dict(handler=tcp.TCPHandler), +) def _handler(conntype, connection_handler): - if conntype == "http": - return HTTPHandler(connection_handler) + if conntype in protocols: + return protocols[conntype]["handler"](connection_handler) raise NotImplementedError |