Make the mitmproxy eventlog display useful information.

This commit is contained in:
Aldo Cortesi 2011-08-02 14:17:15 +12:00
parent 73a7d893e3
commit f3f8462ddc
1 changed files with 13 additions and 3 deletions

View File

@ -21,7 +21,7 @@ import urwid
import controller, utils, filt, proxy, flow, encoding
VIEW_CUTOFF = 1024*100
EVENTLOG_SIZE = 100
EVENTLOG_SIZE = 500
class Stop(Exception): pass
@ -1764,11 +1764,21 @@ class ConsoleMaster(flow.FlowMaster):
# Handlers
def handle_clientconnect(self, r):
self.add_event(urwid.Text("connect"))
self.add_event(urwid.Text("Connect from: %s:%s"%r.address))
return flow.FlowMaster.handle_clientconnect(self, r)
def handle_clientdisconnect(self, r):
self.add_event(urwid.Text("disconnect"))
s = "Disconnect from: %s:%s"%r.client_conn.address
self.add_event(urwid.Text(s))
if r.client_conn.requestcount:
s = " -> handled %s requests"%r.client_conn.requestcount
self.add_event(urwid.Text(s))
if r.client_conn.connection_error:
self.add_event(
urwid.Text(
("error", " -> error: %s"%r.client_conn.connection_error)
)
)
return flow.FlowMaster.handle_clientdisconnect(self, r)
def handle_error(self, r):