Uri does not parse valid URIs with empty authority portion
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.4k
- Forks
- 378
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 5
Description
Per RFC 3986, a valid URI may contain an empty authority (via an empty reg-name). However, it does not parse correctly by the Uri type:
[src/main.rs:6:5] "file:///a/b/c".parse::<Uri>() = Err(
InvalidUri(
InvalidFormat,
),
Similarly, from_parts complains specifically that the authority is missing:
[src/main.rs:11:5] Uri::from_parts(parts) = Err(
InvalidUriParts(
InvalidUri(
AuthorityMissing,
),
),
I could look into a change here, but note this fix would also be a breaking behavior change, and if any users are intentionally using this to enforce a non-empty authority, then they would be impacted.
cc @seanmonstar @LucioFranco - thanks!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Uri parser and Uri::from_parts entry points described in the issue, and compare their behavior with RFC 3986's empty authority rule. Reproduce both provided examples, then add focused coverage showing the intended handling and confirming the resulting parsing and parts-construction behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100