From c29417f7263d0c22d99670757d11a9d93dfccec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20M=C3=BCller?= Date: Fri, 15 Oct 2021 10:01:02 +0200 Subject: [PATCH] Properly handle AF_INET6 requests Socket addresses in the Python socket interface are represented in multiple different ways according to the socket family. Both AF_INET and AF_INET6 families use tuples with the host as the first element. Currently we extract the host from the first element of such a tuple, and ignore the other element. Since AF_INET6 has four elements, this will fail with a ValueError. To support AF_INET6 requests, make sure to store whatever is left of the tuple in a list instead. --- untls_proxy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/untls_proxy.py b/untls_proxy.py index 1f8058c..1b865ab 100755 --- a/untls_proxy.py +++ b/untls_proxy.py @@ -431,7 +431,7 @@ def listen(port): while True: for fd, _ in listening.poll(): # TODO: Threads - conn, (host, _) = sock_by_fd[fd].accept() + conn, (host, *_) = sock_by_fd[fd].accept() proxy(conn, host) conn.close()