Skip to content

Commit 020fd56

Browse files
authored
Merge pull request #1438 from pbiering/fix-1313
extend example and proper format for logged IPv4/IPv6 addresses
2 parents 50e8f1e + b16bc21 commit 020fd56

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

config

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
# CalDAV server hostnames separated by a comma
1515
# IPv4 syntax: address:port
1616
# IPv6 syntax: [address]:port
17-
# For example: 0.0.0.0:9999, [::]:9999
17+
# Hostname syntax (using "getaddrinfo" to resolve to IPv4/IPv6 adress(es)): hostname:port
18+
# For example: 0.0.0.0:9999, [::]:9999, localhost:9999
1819
#hosts = localhost:5232
1920

2021
# Max parallel connections

radicale/server.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ def format_address(address: ADDRESS_TYPE) -> str:
6767
if not isinstance(host, str):
6868
raise NotImplementedError("Unsupported address format: %r" %
6969
(address,))
70-
return "[%s]:%d" % (host, port)
70+
if host.find(":") == -1:
71+
return "%s:%d" % (host, port)
72+
else:
73+
return "[%s]:%d" % (host, port)
7174

7275

7376
class ParallelHTTPServer(socketserver.ThreadingMixIn,

0 commit comments

Comments
 (0)