Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for redirects after a CORS-preflight #15889

Merged
merged 1 commit into from Mar 10, 2017
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -17,7 +17,7 @@ use hyper::mime::{Mime, SubLevel, TopLevel};
use hyper::status::StatusCode;
use mime_guess::guess_mime_type;
use net_traits::{FetchTaskTarget, NetworkError, ReferrerPolicy};
use net_traits::request::{RedirectMode, Referrer, Request, RequestMode, ResponseTainting};
use net_traits::request::{Referrer, Request, RequestMode, ResponseTainting};
use net_traits::request::{Type, Origin, Window};
use net_traits::response::{Response, ResponseBody, ResponseType};
use std::borrow::Cow;
@@ -240,7 +240,6 @@ pub fn main_fetch(request: Rc<Request>,
(!is_simple_method(&request.method.borrow()) ||
request.headers.borrow().iter().any(|h| !is_simple_header(&h)))) {
request.response_tainting.set(ResponseTainting::CorsTainting);
request.redirect_mode.set(RedirectMode::Error);
let response = http_fetch(request.clone(), cache, true, true, false,
target, done_chan, context);
if response.is_network_error() {
@@ -746,11 +746,7 @@ fn http_redirect_fetch(request: Rc<Request>,
request.redirect_count.set(request.redirect_count.get() + 1);

// Step 7
let same_origin = if let Origin::Origin(ref origin) = *request.origin.borrow() {
*origin == request.current_url().origin()
} else {
false
};
let same_origin = location_url.origin()== request.current_url().origin();
let has_credentials = has_credentials(&location_url);

if request.mode == RequestMode::CorsMode && !same_origin && has_credentials {
@@ -0,0 +1,17 @@
[redirect-preflight.htm]
type: testharness
[Disallow redirect 301 after succesful (200) preflight]
expected: FAIL

[Disallow redirect 302 after succesful (200) preflight]
expected: FAIL

[Disallow redirect 303 after succesful (200) preflight]
expected: FAIL

[Disallow redirect 307 after succesful (200) preflight]
expected: FAIL

[Disallow redirect 308 after succesful (200) preflight]
expected: FAIL

This file was deleted.

@@ -1,9 +1,5 @@
[eventsource-cross-origin.htm]
type: testharness
expected: TIMEOUT
[EventSource: cross-origin redirect use]
expected: TIMEOUT

[EventSource: cross-origin allow-origin: http://example.org should fail]
expected: FAIL

@@ -8,3 +8,4 @@

[Check referrerPolicy init value of same-origin and associated getter]
expected: FAIL

@@ -2,3 +2,4 @@
type: testharness
[Request has arrayBuffer method]
expected: FAIL

@@ -1 +1,3 @@
prefs: [layout.viewport.enabled:true]
[viewport_meta.html]
type: reftest
@@ -1 +1,3 @@
prefs: [layout.viewport.enabled:true]
[viewport_rule.html]
type: reftest
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.