diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-09-03 17:01:25 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-09-03 17:01:25 +0200 |
commit | f4272de5ec77fb57723e2274e4ddc50d73489e1e (patch) | |
tree | 2f7ad35411c29c15199f2498bb43571047c0d066 /libmproxy/proxy/root_context.py | |
parent | 1f6d05f89fada5fe360aa79abfa80a3c91ce54da (diff) | |
download | mitmproxy-f4272de5ec77fb57723e2274e4ddc50d73489e1e.tar.gz mitmproxy-f4272de5ec77fb57723e2274e4ddc50d73489e1e.tar.bz2 mitmproxy-f4272de5ec77fb57723e2274e4ddc50d73489e1e.zip |
remove ServerConnectionMixin.reconnect
Diffstat (limited to 'libmproxy/proxy/root_context.py')
-rw-r--r-- | libmproxy/proxy/root_context.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libmproxy/proxy/root_context.py b/libmproxy/proxy/root_context.py index 35909612..88df8e47 100644 --- a/libmproxy/proxy/root_context.py +++ b/libmproxy/proxy/root_context.py @@ -85,9 +85,28 @@ class RootContext(object): # d = top_layer.client_conn.rfile.peek(len(HTTP2Protocol.CLIENT_CONNECTION_PREFACE)) # is_http2_magic = (d == HTTP2Protocol.CLIENT_CONNECTION_PREFACE) + def log(self, msg, level, subs=()): + """ + Send a log message to the master. + """ + + full_msg = [ + "{}: {}".format(repr(self.client_conn.address), msg) + ] + for i in subs: + full_msg.append(" -> " + i) + full_msg = "\n".join(full_msg) + self.channel.tell("log", Log(full_msg, level)) + @property def layers(self): return [] def __repr__(self): return "RootContext" + + +class Log(object): + def __init__(self, msg, level="info"): + self.msg = msg + self.level = level
\ No newline at end of file |