Skip to main content
GameDev.net gamedev.net
🔒 Locked

Hiding multiple schemes within URI

Started by nife87 Feb 13, 2013 at 8:54 PM 0 replies 2.3k views
Original Post
nife87
nife87

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).

jonathanjansson
jonathanjansson

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 ':'.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.