Skip to content

Comments

Fix invalid hostname parsing for ipv6 formatted host header#4564

Merged
Marsup merged 2 commits intohapijs:masterfrom
kanongil:fix-ipv6-hostname
Feb 19, 2026
Merged

Fix invalid hostname parsing for ipv6 formatted host header#4564
Marsup merged 2 commits intohapijs:masterfrom
kanongil:fix-ipv6-hostname

Conversation

@kanongil
Copy link
Contributor

The parsing does not correctly handle IPv6 hostnames in the Host header. [::1] resolves to [;

This updated logic should be able to parse all valid host headers, and only remove the port part if it very clearly is a port. Eg. host:123a will set the hostname host:123a.

This PR does not change the value for any valid Host headers using DNS hostnames or IPv4 addresses.

@kanongil kanongil added the bug Bug or defect label Feb 19, 2026
@Marsup Marsup added this to the 21.4.6 milestone Feb 19, 2026
@Marsup Marsup self-assigned this Feb 19, 2026
@Marsup Marsup merged commit 97c435f into hapijs:master Feb 19, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bug or defect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants