mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
fix #956
This commit is contained in:
parent
ecb26c3c82
commit
2bec6a35e2
@ -355,9 +355,6 @@ class Address(utils.Serializable):
|
||||
def __repr__(self):
|
||||
return "{}:{}".format(self.host, self.port)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.address)
|
||||
|
||||
def __eq__(self, other):
|
||||
if not other:
|
||||
return False
|
||||
@ -698,8 +695,7 @@ class TCPClient(_Connection):
|
||||
if self.source_address:
|
||||
connection.bind(self.source_address())
|
||||
connection.connect(self.address())
|
||||
if not self.source_address:
|
||||
self.source_address = Address(connection.getsockname())
|
||||
self.source_address = Address(connection.getsockname())
|
||||
except (socket.error, IOError) as err:
|
||||
raise TcpException(
|
||||
'Error connecting to "%s": %s' %
|
||||
|
@ -748,17 +748,15 @@ class TestPeekSSL(TestPeek):
|
||||
|
||||
|
||||
class TestAddress:
|
||||
|
||||
def test_simple(self):
|
||||
a = tcp.Address("localhost", True)
|
||||
a = tcp.Address(("localhost", 80), True)
|
||||
assert a.use_ipv6
|
||||
b = tcp.Address("foo.com", True)
|
||||
b = tcp.Address(("foo.com", 80), True)
|
||||
assert not a == b
|
||||
assert str(b) == str(tuple("foo.com"))
|
||||
c = tcp.Address("localhost", True)
|
||||
c = tcp.Address(("localhost", 80), True)
|
||||
assert a == c
|
||||
assert not a != c
|
||||
assert repr(a)
|
||||
assert repr(a) == "localhost:80"
|
||||
|
||||
|
||||
class TestSSLKeyLogger(tservers.ServerTestBase):
|
||||
|
Loading…
Reference in New Issue
Block a user