diff options
-rw-r--r-- | mitmproxy/net/tcp.py | 4 |
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 |