Sign in to follow this  

Hiding multiple schemes within URI

This topic is 1798 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am currently writing a URI parser whilst reading the official documentation and noticed that it should be legal to conceal another/multiple schemes within the URI syntax. I would like to be able to specify multiple schemes within a valid URI, like so:

vfs:zip///home/user/test.zip

vfs:zip:file///home/user/test.zip#data/text.log

vfs:zip:file//user:encrypted-password@localhost:127/home/user/test.zip#data/text.log

 

According to the Generic Syntax (RFC 3986), specifically sections 3 - 3.3 (not all text is listed here):

URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty
 

This means that any characters between the first ':' and the first '/' (specifying either authority or path) should be skipped by parsers and still validate the URI, enabling me to provide zero or more schemes (zip, file, http, etc.) after the primary scheme (vfs, in this case), as far as I can tell.

 

Any thoughts as to whether or not this is correctly understood?

 

Otherwise, I think I have to provide the additional schemes via the path part or as a query or fragment, although I would prefer to provide them up-front, like the above, in order to preserve the rest of URI from preliminary preprocessing (other than normalization and percent-decoding).

Edited by nife87

Share this post


Link to post
Share on other sites

There are no skipped characters after ':'. The variations cover the following cases:

 

scheme://authority/absolute/path

scheme://authority

scheme:/absolute/path

scheme:rootless/path

scheme:

 

http://en.wikipedia.org/wiki/URI_schemes lists some examples how various applications implement their URI schemes. Some of them abuses the authority component as a first path segment which seems wrong. It is allowed to skip '//' and start the path immediately after ':'.

Share this post


Link to post
Share on other sites
Sign in to follow this