mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Use the correct origin in fetch
This commit is contained in:
parent
5227df260c
commit
d5e7137b52
1 changed files with 5 additions and 3 deletions
|
@ -671,8 +671,10 @@ pub fn http_redirect_fetch(request: &mut Request,
|
||||||
request.redirect_count += 1;
|
request.redirect_count += 1;
|
||||||
|
|
||||||
// Step 7
|
// Step 7
|
||||||
// FIXME: Correctly use request's origin
|
let same_origin = match request.origin {
|
||||||
let same_origin = location_url.origin() == request.current_url().origin();
|
Origin::Origin(ref origin) => *origin == location_url.origin(),
|
||||||
|
Origin::Client => panic!("Request origin should not be client for {}", request.current_url()),
|
||||||
|
};
|
||||||
let has_credentials = has_credentials(&location_url);
|
let has_credentials = has_credentials(&location_url);
|
||||||
|
|
||||||
if request.mode == RequestMode::CorsMode && !same_origin && has_credentials {
|
if request.mode == RequestMode::CorsMode && !same_origin && has_credentials {
|
||||||
|
@ -691,7 +693,7 @@ pub fn http_redirect_fetch(request: &mut Request,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 10
|
// Step 10
|
||||||
if cors_flag && !same_origin {
|
if cors_flag && location_url.origin() != request.current_url().origin() {
|
||||||
request.origin = Origin::Origin(ImmutableOrigin::new_opaque());
|
request.origin = Origin::Origin(ImmutableOrigin::new_opaque());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue