Skip to content

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

Open
@richard-w

Description

@richard-w

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions