aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsmill@cuckoo.sh <smill@cuckoo.sh>2016-09-22 08:15:34 +0000
committersmill@cuckoo.sh <smill@cuckoo.sh>2016-09-22 08:15:34 +0000
commit3962a11575ec6118cff8ba10ec81b9679e68faa2 (patch)
treed30df7d97fc5de75c74836f3c80483beab6d4269
parent2d4e4eafe1545e9ac79c04fcfc48f198e85900aa (diff)
downloadmitmproxy-3962a11575ec6118cff8ba10ec81b9679e68faa2.tar.gz
mitmproxy-3962a11575ec6118cff8ba10ec81b9679e68faa2.tar.bz2
mitmproxy-3962a11575ec6118cff8ba10ec81b9679e68faa2.zip
Commented on IP_TRANSPARENT and changed an exception type.
-rw-r--r--netlib/tcp.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/netlib/tcp.py b/netlib/tcp.py
index 4e988ee3..47200bed 100644
--- a/netlib/tcp.py
+++ b/netlib/tcp.py
@@ -738,10 +738,11 @@ class TCPClient(_Connection):
if self.spoof_source_address:
try:
+ # 19 is `IP_TRANSPARENT`, which is only available on Python 3.3+ on some OSes
if not connection.getsockopt(socket.SOL_IP, 19):
connection.setsockopt(socket.SOL_IP, 19, 1)
except socket.error as e:
- raise exceptions.ProtocolException(
+ raise exceptions.TcpException(
"Failed to spoof the source address: " + e.strerror)
if self.source_address:
connection.bind(self.source_address())