hyperium / hyperium/http

Some Uri round-tripping through Parts fails unexpectantly

Open
#394 3 comments 0 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

This might be because I am not well versed in the HTTP URI standards but I would expect following two pieces of code to produce the same (or basically the same) Parts instances.

1:

let mut parts = Uri::from_static("localhost:8080").into_parts();
parts.scheme = Some(Scheme::HTTPS);

2:

let parts = Uri::from_static("https://localhost:8080").into_parts();

However, for 2, the path_and_query is set to effectively Some("/") where as in 1 it is set to None. Which means that putting them back into a Uri, the second one passes where as the first one fails.

I think that the first one should work.

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

Reproduce the two examples using Uri::from_static, into_parts, Parts, and the scheme assignment shown in the issue. Inspect how URI parts are parsed and reconstructed; done means both examples produce equivalent Parts and can be converted back into a Uri successfully.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.