URIs the do not have '//' after 'scheme:'
Closed this issue · 1 comments
The 'mailto' (and 'urn', 'news', etc.) schemes do not have the double forward slash after the colon.
I was looking for a library to better parse URIs and found a reference to this project.
I noticed that:
- https://github.com/NET-A-PORTER/scala-uri/blob/master/src/test/scala/com/netaporter/uri/ParsingTests.scala#L94
- https://github.com/NET-A-PORTER/scala-uri/blob/master/README.md#user-information
mention the 'mailto' scheme, and have been integrating the library into my project, but ran into an issue.
A valid mailto 'mailto:user@host' parses with the entire URI as a 'path' (incidentally with a prefixed '/').
I thought about inserting the "//" after the colon to parse as the 'scheme', 'user' and 'host', but another valid mailto is ''mailto:user1@host1,user2@host2' which parses with 'host,user2@host' as the 'host'.
Questions:
- Is this library intended to support URIs that do not have '//' and parse the scheme?
If yes: The RFC specifies that URIs without a '//' have everything after the 'scheme:' and before '?query' as the path. (RFC section 3. Syntax Components)
- I believe (from the RFC) the 'host' cannot contain '@'. Is this library intended to provide that level of compliance with the RFC?
Good spot. Those mailto URIs look wrong...
I would like scala-uri
to support URIs that do not have '//', but currently it does not.
I would prefer scala-uri
not to enforce too many of the restrictions in the RFC as there are a lot of technically invalid URIs out there on the Internet. I'd rather that the parsing was permissive and allowed users to parse these URIs.