Skip to content

Commit

Permalink
Merge pull request #1438 from pbiering/fix-1313
Browse files Browse the repository at this point in the history
extend example and proper format for logged IPv4/IPv6 addresses
  • Loading branch information
pbiering authored Mar 14, 2024
2 parents 50e8f1e + b16bc21 commit 020fd56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion config
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
# CalDAV server hostnames separated by a comma
# IPv4 syntax: address:port
# IPv6 syntax: [address]:port
# For example: 0.0.0.0:9999, [::]:9999
# Hostname syntax (using "getaddrinfo" to resolve to IPv4/IPv6 adress(es)): hostname:port
# For example: 0.0.0.0:9999, [::]:9999, localhost:9999
#hosts = localhost:5232

# Max parallel connections
Expand Down
5 changes: 4 additions & 1 deletion radicale/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 020fd56

Please sign in to comment.