url icon indicating copy to clipboard operation
url copied to clipboard

Support IPv6 literal

Open AlexanderEkdahl opened this issue 6 years ago • 4 comments

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 https://github.com/elm/url/issues/12

AlexanderEkdahl avatar Oct 05 '19 21:10 AlexanderEkdahl

@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 avatar Jul 29 '20 05:07 venkatbvc

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

venkatbvc avatar Aug 07 '20 11:08 venkatbvc

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

AlexanderEkdahl avatar Aug 16 '20 03:08 AlexanderEkdahl

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?

rupertlssmith avatar Feb 17 '23 09:02 rupertlssmith