closure-library
closure-library copied to clipboard
goog.uri.utils/split doesn't parse schemes with periods
https://github.com/google/closure-library/blob/6fa0e27a0ef224e2909ecd872d02c9685fa1aa3a/closure/goog/uri/utils.js#L239
Split doesn't parse the scheme if there is a .
in it. According to the RFC it is an unreserved char, and it should be OK.
goog.uri.utils.split("foo.bar://domain.tld/baz/quxx");
=>
["foo.bar://domain.tld/baz/quxx", undefined, undefined, undefined, undefined, "foo.bar://domain.tld/baz/quxx", undefined, undefined]
I think your link is a little bit off, since scheme
isn't defined in terms of unreserved
, but is is defined in Appendix A as ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
, so you're correct that .
should be allowed.
That said, I'm a bit puzzled about how to distinguish scheme:hier-part
from authority:port
, since we currently parse foo.bar:80
as the authority foo.bar
with port 80
, but if we allow foo.bar
to parse as the scheme, then (in my reading) 80
is also a valid hier-part
via path-rootless
which can be one or more pchar
, which includes all unreserved
characters (including digits).
Do you have a specific use case in mind?