diff options
author | Maximilian Hils <git@maximilianhils.com> | 2018-03-23 04:26:36 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2018-03-23 04:26:46 +0100 |
commit | fed54fa3d09362965721f99d2a4e74f9ddff40e8 (patch) | |
tree | cf7d6729b20d907675ade9aa5193d1da0070be5a /mitmproxy/connections.py | |
parent | 623f9b694d9f9ddc9130d03b7ffb079c1c492dc6 (diff) | |
download | mitmproxy-fed54fa3d09362965721f99d2a4e74f9ddff40e8.tar.gz mitmproxy-fed54fa3d09362965721f99d2a4e74f9ddff40e8.tar.bz2 mitmproxy-fed54fa3d09362965721f99d2a4e74f9ddff40e8.zip |
don't crash if server address is unknown, fix #2969
Diffstat (limited to 'mitmproxy/connections.py')
-rw-r--r-- | mitmproxy/connections.py | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/mitmproxy/connections.py b/mitmproxy/connections.py index 29ab6ab5..9c26b44f 100644 --- a/mitmproxy/connections.py +++ b/mitmproxy/connections.py @@ -1,18 +1,18 @@ -import time - import os +import time import typing import uuid -from mitmproxy import stateobject, exceptions from mitmproxy import certs +from mitmproxy import exceptions +from mitmproxy import stateobject from mitmproxy.net import tcp from mitmproxy.net import tls +from mitmproxy.utils import human from mitmproxy.utils import strutils class ClientConnection(tcp.BaseHandler, stateobject.StateObject): - """ A client connection @@ -72,11 +72,10 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject): else: alpn = "" - return "<ClientConnection: {tls}{alpn}{host}:{port}>".format( + return "<ClientConnection: {tls}{alpn}{address}>".format( tls=tls, alpn=alpn, - host=self.address[0], - port=self.address[1], + address=human.format_address(self.address), ) def __eq__(self, other): @@ -161,7 +160,6 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject): class ServerConnection(tcp.TCPClient, stateobject.StateObject): - """ A server connection @@ -209,11 +207,10 @@ class ServerConnection(tcp.TCPClient, stateobject.StateObject): ) else: alpn = "" - return "<ServerConnection: {tls}{alpn}{host}:{port}>".format( + return "<ServerConnection: {tls}{alpn}{address}>".format( tls=tls, alpn=alpn, - host=self.address[0], - port=self.address[1], + address=human.format_address(self.address), ) def __eq__(self, other): |