Skip to content

Fix formatting of URLs with IPv6 addresses in them. - #919

Merged
gi0baro merged 2 commits into
emmett-framework:masterfrom
de-vri-es:fix-formatting-of-urls-with-ipv6-address
Sep 28, 2026
Merged

gi0baro merged 2 commits into
emmett-framework:masterfrom
de-vri-es:fix-formatting-of-urls-with-ipv6-address

Conversation

@de-vri-es

Copy link
Copy Markdown
Contributor

Hey!

I noticed that the logged URLs are invalid when you specify an IPv6 address as bind address. For example, this is what got logged in my case:

[INFO] Listening at: http://::1:4000

The URL should be formatted as http://[::1]:4000 to avoid ambiguity between IPv6 address components and the port number.

This PR checks if the bind address is an IPv6 address, and then adds the square brackets as needed.

Note: I didn't go for a simpler if ':' in self.bind_addr. This kinda works, but it would also match things like localhost:8080, which people might accidentally put in the address argument of the constructor.

@gi0baro
gi0baro merged commit 22b54de into emmett-framework:master Sep 28, 2026
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants