aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mitmproxy/console/flowdetailview.py5
-rw-r--r--mitmproxy/models/connections.py28
2 files changed, 28 insertions, 5 deletions
diff --git a/mitmproxy/console/flowdetailview.py b/mitmproxy/console/flowdetailview.py
index f4b4262e..757c76fd 100644
--- a/mitmproxy/console/flowdetailview.py
+++ b/mitmproxy/console/flowdetailview.py
@@ -22,7 +22,7 @@ def flowdetails(state, flow):
if sc is not None:
text.append(urwid.Text([("head", "Server Connection:")]))
parts = [
- ["Address", "%s:%s" % sc.address()],
+ ["Address", repr(sc.address)],
]
text.extend(
@@ -79,8 +79,7 @@ def flowdetails(state, flow):
text.append(urwid.Text([("head", "Client Connection:")]))
parts = [
- ["Address", "%s:%s" % cc.address()],
- # ["Requests", "%s"%cc.requestcount],
+ ["Address", repr(cc.address)],
]
text.extend(
diff --git a/mitmproxy/models/connections.py b/mitmproxy/models/connections.py
index d5920256..857580b8 100644
--- a/mitmproxy/models/connections.py
+++ b/mitmproxy/models/connections.py
@@ -8,7 +8,6 @@ from .. import stateobject, utils
class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
-
def __init__(self, client_connection, address, server):
# Eventually, this object is restored from state. We don't have a
# connection then.
@@ -65,6 +64,17 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
f.set_state(state)
return f
+ @classmethod
+ def make_dummy(cls, address):
+ return cls.from_state(dict(
+ address=dict(address=address, use_ipv6=False),
+ clientcert=None,
+ ssl_established=False,
+ timestamp_start=None,
+ timestamp_end=None,
+ timestamp_ssl_setup=None
+ ))
+
def convert_to_ssl(self, *args, **kwargs):
super(ClientConnection, self).convert_to_ssl(*args, **kwargs)
self.timestamp_ssl_setup = utils.timestamp()
@@ -75,7 +85,6 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
class ServerConnection(tcp.TCPClient, stateobject.StateObject):
-
def __init__(self, address, source_address=None):
tcp.TCPClient.__init__(self, address, source_address)
@@ -123,6 +132,21 @@ class ServerConnection(tcp.TCPClient, stateobject.StateObject):
f.set_state(state)
return f
+ @classmethod
+ def make_dummy(cls, address):
+ return cls.from_state(dict(
+ address=dict(address=address, use_ipv6=False),
+ cert=None,
+ sni=None,
+ source_address=dict(address=('', 0), use_ipv6=False),
+ ssl_established=False,
+ timestamp_start=None,
+ timestamp_tcp_setup=None,
+ timestamp_ssl_setup=None,
+ timestamp_end=None,
+ via=None
+ ))
+
def copy(self):
return copy.copy(self)