Skip to content

Conversation

@AlexanderEkdahl
Copy link

@AlexanderEkdahl AlexanderEkdahl commented Oct 5, 2019

According to https://tools.ietf.org/html/rfc3986#section-3.2.2 for any URL the IPv6 literal must be enclosed in square brackets.

This implementation assumes anything remaining after the brackets is the port.

Valid URLs

> Url.fromString "http://[2001:db8:a0b:12f0::1]/index.html"
Just { fragment = Nothing, host = "[2001:db8:a0b:12f0::1]", path = "/index.html", port_ = Nothing, protocol = Http, query = Nothing }
> Url.fromString "http://[2001:db8:a0b:12f0::1]:80/index.html"
Just { fragment = Nothing, host = "[2001:db8:a0b:12f0::1]", path = "/index.html", port_ = Just 80, protocol = Http, query = Nothing }

Rejected URLs

> Url.fromString "http://[/index.html" -- missing ]
Nothing

This fixes #12

@venkatbvc
Copy link

@evancz i saw you have submitted some PRs in Elm/Url. Don't know who is the Maintainer for this git. Can this code be merged? we are having this issue

@venkatbvc
Copy link

@AlexanderEkdahl can you let me know how we can use your fix and compile our code?

@AlexanderEkdahl
Copy link
Author

@venkatbvc I am not able to provide support in this matter as I no longer actively work with Elm.

@rupertlssmith
Copy link

Lines 167-180 change the whitespace of the code there but do not introduce any code changes. A patch should not introduce whitespace only changes, and only modify the lines it really needs to.

Seems like a good patch other than that.

Can a new minimal patch be made for this?

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.

Parsing URLs with IPv6 host

3 participants