Explorar el Código

correct IPv4/IPv6 address output

Peter Bieringer hace 1 año
padre
commit
b16bc212f6
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4 1
      radicale/server.py

+ 4 - 1
radicale/server.py

@@ -67,7 +67,10 @@ def format_address(address: ADDRESS_TYPE) -> str:
     if not isinstance(host, str):
         raise NotImplementedError("Unsupported address format: %r" %
                                   (address,))
-    return "[%s]:%d" % (host, port)
+    if host.find(":") == -1:
+        return "%s:%d" % (host, port)
+    else:
+        return "[%s]:%d" % (host, port)
 
 
 class ParallelHTTPServer(socketserver.ThreadingMixIn,