From 057af32553dd006424aa0e574e4f5a5907ea78ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Sun, 17 Oct 2021 18:28:36 +0300 Subject: [PATCH] Support IPv6 address syntax for hosts --- untls_proxy.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/untls_proxy.py b/untls_proxy.py index 4f7963b..41e63d6 100755 --- a/untls_proxy.py +++ b/untls_proxy.py @@ -253,6 +253,8 @@ def proxy(sock, host): print('Bad port number', file=sys.stderr) sock.sendall(b'HTTP/1.0 400 Bad Request\r\n\r\nBad port number\n') return + if remote_host[:1] == b'[' and remote_host[-1:] == b']': #IPv6 + remote_host = remote_host[1:-1] try: remote_host = remote_host.decode('ascii') except UnicodeDecodeError: