hyperium / hyperium/http

parse::<Uri> fails to parse uris with triple slash after scheme

Open
#323 7 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.4k
Forks
378
Avg merge
1d 21h
Merged PRs (30d)
5

Description

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 like unix:///var/run/socket.sock

The following expression panics with InvalidUri(InvalidFormat):

"unix:///path/to/foo.sock".parse::<Uri>().unwrap();

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:

  • There are http services that do listen on unix sockets (docker for example)
  • Allowing relative file and unix URIs while not allowing absolute ones is inconsistent

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Uri parser entry point exercised by "unix:///path/to/foo.sock". Reproduce the InvalidUri(InvalidFormat) panic, compare it with the working relative-path form, and verify that absolute triple-slash unix or file-style URIs parse without breaking existing relative URI behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.