Allow custom schemes to have non-opaque origins
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 406
- PR merge metrics
- No merged PRs in 30d
Description
- Note that this crate implements the URL Standard not RFC 1738 or RFC 3986
Describe the bug
All schemes that are not on the standard list get an opaque origin from https://github.com/servo/rust-url/blob/a66f4220895c3cc84ae623c218466710eb3a812f/url/src/origin.rs#L17 . This makes all origin comparison fail, which in turn causes issues such as CSP violations being reported because 'self' never matches.
It would be very useful to also be able to specify a list of schemes that are not standard ones but can also get a tuple origin. If we reuse the Origin::Tuple() for these we also need to let them provide a default port (see https://github.com/servo/rust-url/blob/a66f4220895c3cc84ae623c218466710eb3a812f/url/src/parser.rs#L186).
I guess that ideally custom schemes should bring their own origin type and we should refactor the whole Origin type to be trait based.
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 url/src/origin.rs and url/src/parser.rs, especially the linked origin selection and default-port logic. Define how callers specify custom schemes and their default ports, and determine whether the existing Origin::Tuple variant is sufficient or a trait-based Origin redesign is required. Done means custom schemes can receive non-opaque origins and origin comparisons work as intended.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100