Skip to content

Allow custom schemes to have non-opaque origins #1111

@webbeef

Description

@webbeef
  • 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

pub fn url_origin(url: &Url) -> Origin {
. 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

pub fn default_port(scheme: &str) -> Option<u16> {
).

I guess that ideally custom schemes should bring their own origin type and we should refactor the whole Origin type to be trait based.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions