Skip to content

CORS check compares strings, not URL components #6020

Closed

Description

@SimonSapin

https://fetch.spec.whatwg.org/#cors-check includes:

Let origin be the result of parsing Access-Control-Allow-Origin in response's header list.
…
If request's origin, serialized and utf-8 encoded, is not origin, return failure.

The corresponding code in Servo is in script::cors::allow_cross_origin_request:

        Some(&AccessControlAllowOrigin::Value(ref url)) =>
            url.scheme == req.origin.scheme &&
            url.host() == req.origin.host() &&
            url.port() == req.origin.port(),

But comparing (scheme, host, port) components of parsed URL is not necessarily the same as comparing a serialized URL to a string. Maybe AccessControlAllowOrigin::Value’s value should be a String rather than a parsed Url?

Activity

  1. Manishearth commented on May 12, 2015

    @Manishearth
    Member

    cc me

  2. SimonSapin commented on May 13, 2015

    @SimonSapin
    MemberAuthor

    I don’t know if that either is equivalent to what the spec says.

  3. Manishearth commented on May 13, 2015

    @Manishearth
    Member
  4. SimonSapin commented on Jul 10, 2015

    @SimonSapin
    MemberAuthor

    hyperium/hyper#526 was fixed in hyperium/hyper@ed45862 , which we’re picking up in #6591.

  5. added 4 commits that reference this issue on Jul 10, 2015
    35ea678
    a02e7d8
    21433eb
    9af229b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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