aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2017-05-17 10:38:31 +0800
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2017-05-17 10:38:31 +0800
commitca46b1e340750859881347ead92a64ed05105d25 (patch)
tree93a535c38b804cdb3574d4b6694f8355992069bb
parent3fadda2bbad10fddc055d61c417304fcaab8eff1 (diff)
downloadmitmproxy-ca46b1e340750859881347ead92a64ed05105d25.tar.gz
mitmproxy-ca46b1e340750859881347ead92a64ed05105d25.tar.bz2
mitmproxy-ca46b1e340750859881347ead92a64ed05105d25.zip
alpn_select_callback must be a callable
-rw-r--r--mitmproxy/net/tcp.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/mitmproxy/net/tcp.py b/mitmproxy/net/tcp.py
index b4c4ac64..76944b8b 100644
--- a/mitmproxy/net/tcp.py
+++ b/mitmproxy/net/tcp.py
@@ -524,9 +524,11 @@ class _Connection:
return options[0]
context.set_alpn_select_callback(alpn_select_callback)
elif alpn_select_callback is not None and alpn_select is None:
+ if not callable(alpn_select_callback):
+ raise exceptions.TlsException("ALPN error: alpn_select_callback must be a function.")
context.set_alpn_select_callback(alpn_select_callback)
elif alpn_select_callback is not None and alpn_select is not None:
- raise exceptions.TlsException("ALPN error: only define alpn_select (string) OR alpn_select_callback (method).")
+ raise exceptions.TlsException("ALPN error: only define alpn_select (string) OR alpn_select_callback (function).")
return context