servo / servo/rust-url

URL stringifies to invalid URL: Err(EmptyHost)

Open
#548 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.6k
Forks
406
PR merge metrics
No merged PRs in 30d

Description

Found with KLEE.

let u = Url::parse("WS:\u{34f}").unwrap() succeeds, but u.as_str() returns ws:/// which is an invalid URL and doesn't parse the next time.

Both Chrome and Firefox consider the original URL to be invalid.


I also found another example of differing behavior by accident (mistyped the unicode codepoint value when verifying in a browser). The URL WS:\u{35f} is invalid in Chrome and rust-url, but parses successfully in Firefox (gets returned as ws://xn--zn7c).

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 by reproducing the KLEE examples with Url::parse, especially WS:\u{34f} and WS:\u{35f}, then inspect how the parsed URL is returned by as_str(). Compare parsing and stringification against the Chrome, Firefox, and rust-url behaviors described in the issue; done means the invalid ws:/// round trip is addressed without changing the documented handling of the second example.

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
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.