Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing of IPv6 addresses seems to incorrectly include []s #770

Open
1 task
jszwedko opened this issue May 26, 2022 · 0 comments
Open
1 task

Parsing of IPv6 addresses seems to incorrectly include []s #770

jszwedko opened this issue May 26, 2022 · 0 comments

Comments

@jszwedko
Copy link

  • Note that this crate implements the URL Standard not RFC 1738 or RFC 3986

Describe the bug

Hi all!

It seems like parsing a URL that contains an IPv6 address like http://[::1] returns a Url struct that, when .host().unwrap.to_string() is called on it, returns [::1] where the docs state, for Host:

An IPv6 address. Url::host_str returns the serialization of that address between [ and ] brackets, in the format per RFC 5952 A Recommendation for IPv6 Address Text Representation: lowercase hexadecimal with maximal :: compression.

The "between" language here makes me think that it should not be including the [].

According to the linked URL Standard, it also states, for host parsing, that:

If input starts with U+005B ([), then:

If input does not end with U+005D (]), validation error, return failure.

Return the result of IPv6 parsing input with its leading U+005B ([) and trailing U+005D (]) removed.

Which makes it seem like the [] should be removed.

I'm just curious to get more clarity on expected behavior here.

This came up due to some confusion in nats-io/nats.rs#386

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

No branches or pull requests

1 participant