-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parse::<Uri> fails to parse uris with triple slash after scheme #323
Comments
Probably fine to support. You mind submitting a PR? |
I do not mind at all but I am a little short on time right now so it may take a while. |
As far as I understand, this is not strictly speaking a valid HTTP request target (you can start tracing from here). As I understand it, the correct way to write it is |
According to Wikipedia, triple-slash and single-slash are both correct, double-slash is common but wrong: https://en.wikipedia.org/wiki/File_URI_scheme |
This changes the URI parser to allow URIs of the forms * scheme:/absolute/path * scheme:///absolute/path It does impact HTTP URI parsing in that HTTP URIs without an authority part are now allowed. Fixes issue hyperium#323
I think the issue here is that this crate can only talk about URLs that are expected to eventually speak HTTP. The lack of Just thinking out loud. |
The |
URIs that reference resources on a local filesystem often use URIs of the format
<scheme>://<path_to_file>
. If the path is absolute that leads to URIs with 3 slashes after the scheme likeunix:///var/run/socket.sock
The following expression panics with
InvalidUri(InvalidFormat)
:while a similar expression using a relative file path like
unix://relative/path/to.sock
works just fine.While I understand that the http crate does not aim to provide a completely compliant URI parser I still think this should be fixed here because:
file
andunix
URIs while not allowing absolute ones is inconsistentThe text was updated successfully, but these errors were encountered: