Skip to content

fix(http): accept a bare ipv6 host joined with a port - #351

Closed
tzssangglass wants to merge 1 commit into
ledgetech:masterfrom
Kong:ipv6
Closed

tzssangglass wants to merge 1 commit into
ledgetech:masterfrom
Kong:ipv6

Conversation

@tzssangglass

Copy link
Copy Markdown

A caller that builds "scheme://" .. host .. ":" .. port with a bare IPv6 host produces "http://::1:8080", which no URI grammar can parse: the colons are ambiguous. Tolerate it in parse_uri by splitting at the last colon only when the part before it already looks like an IPv6 address (two or more colons), then bracket that part.

Names, IPv4 addresses and hosts that already carry brackets are left untouched, and a portless bare literal is still rejected rather than guessed.

A caller that builds "scheme://" .. host .. ":" .. port with a bare IPv6
host produces "http://::1:8080", which no URI grammar can parse: the
colons are ambiguous. Tolerate it in parse_uri by splitting at the last
colon only when the part before it already looks like an IPv6 address
(two or more colons), then bracket that part.

Names, IPv4 addresses and hosts that already carry brackets are left
untouched, and a portless bare literal is still rejected rather than
guessed.
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.

1 participant