lambdaisland / uri

A pure Clojure/ClojureScript URI library
Mozilla Public License 2.0
243 stars 21 forks source link

Support ipv6 literals #27

Closed ekimber closed 9 months ago

ekimber commented 2 years ago

Added a very simple expression to the regex (no validation etc) to allow ipv6 literals in uris

KaliszAd commented 2 years ago

Looks good to me. I would use an address with the documentation prefix https://datatracker.ietf.org/doc/html/rfc3849 for the test. Using link-local addresses might prove problematic since you actually have to provide the interface identifier, because link-local addresses need it for scoping. (https://ungleich.ch/u/blog/ipv6-link-local-support-in-browsers/).

darrellroot commented 2 years ago

I hope that test indicates a failure because fe80::4ecc:6aff::00aa is not a valid IPv6 address. It has two sets of double-colons. IPv6 addresses can only have one set of double colons otherwise the expansion is ambiguous.

KaliszAd commented 2 years ago

I hope that test indicates a failure because fe80::4ecc:6aff::00aa is not a valid IPv6 address. It has two sets of double-colons. IPv6 addresses can only have one set of double colons otherwise the expansion is ambiguous.

Yes, that shouldn't pass, I must admit I overlooked that one - was fixated on the documentation prefix I guess.

NiKiZe commented 2 years ago

In regards to link local fe80::1%eth0 (depending on platform) is valid

plexus commented 2 years ago

@ekimber Thanks for this PR! Just to give you a heads-up, I asked on twitter if folks could help by having a look at this PR, since I'm not very well acquainted with the ins and outs of IPv6. It got a few retweets so you might get a bunch of feedback here.

plexus commented 9 months ago

released in

[lambdaisland/uri "1.19.155"]
{lambdaisland/uri {:mvn/version "1.19.155"}}

while the current matching might be too lenient, it should already be useful in a lot of cases. This library is not meant to be an authoratative mechanism for validating URIs, it is for interpreting URIs that are assumed to be well formed. Follow-up PRs to make this better match the spec are of course welcome.