not-a-base on host:port string
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 406
- PR merge metrics
- No merged PRs in 30d
Description
I'm using the URL library to parse a Host header, and when my application is running on localhost the value that comes out of the header is localhost:3000 (for example).
This value is parsed into a Url but comes out with cannot_be_a_base() as true, so I can't join it.
With url 2.1.1 I can't call set_scheme on the parsed URL either, but that seems to be related to another regression that multiple people have raised in #577. With 2.1.0 I can call set_scheme on the parsed URL but it still comes out as cannot_be_a_base().
I worked around this by prepending "http://" onto whatever comes out of the Host header. I see this library also has a Host struct, but I don't see any way to convert a Host into a Url. I guess what' I'm looking for is a better way to build a URL from parts.
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 by reproducing the localhost:3000 case with the URL parser and compare the behavior in versions 2.1.0 and 2.1.1, including cannot_be_a_base() and set_scheme. Read the Url and Host APIs to determine how host-header values should become joinable URLs; done means the reported value has a supported path without prepending a scheme manually.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100