From 57ada3728c0d45b0bdc1593c72d268e2e8c65baf Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 2 May 2025 16:18:28 -0400 Subject: [PATCH] Change default host to localhost only Also, fix support for IPv4 addresses as bind_host --- confluent_server/confluent/httpapi.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/confluent_server/confluent/httpapi.py b/confluent_server/confluent/httpapi.py index b2d45f0c..9ac44d5e 100644 --- a/confluent_server/confluent/httpapi.py +++ b/confluent_server/confluent/httpapi.py @@ -1226,8 +1226,9 @@ def serve(bind_host, bind_port): bind_host, family=socket.AF_UNIX) os.chmod(bind_host, 0o666) else: + addrinfo = socket.getaddrinfo(bind_host, bind_port)[0] sock = eventlet.listen( - (bind_host, bind_port, 0, 0), family=socket.AF_INET6) + addrinfo[-1], family=addrinfo[0]) except socket.error as e: if e.errno != 98: raise @@ -1251,7 +1252,7 @@ def serve(bind_host, bind_port): class HttpApi(object): def __init__(self, bind_host=None, bind_port=None): self.server = None - self.bind_host = bind_host or '::' + self.bind_host = bind_host or '127.0.0.1' self.bind_port = bind_port or 4005 def start(self):