servo / servo/rust-url

URL with username/password removed creates invalid URL with .to_string()

Open
#796 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

When setting username/password to empty string value, : and @ chars should be removed from the URL when using to_string().

Steps to reproduce:

  • Have a String URL with username and password: https://username:password@example.com.
  • Create a new URL using Url::parse() from the String.
  • Use set_username() and set_password() to reset the values as empty strings.
  • .as_str() or .to_string() for the Url shows: https://:@example.com/.

Using version 2.3.1 of the crate.

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 with the Url::parse(), set_username(), and set_password() entry points and follow the as_str()/to_string() serialization path. Reproduce the example from the issue, then verify that clearing both credentials removes the ':' and '@' characters from the serialized URL.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.