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

Initiate redirect fetching iff the request has a location #26475

Merged
merged 1 commit into from May 9, 2020
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Initiate redirect fetching iff the request has a location

Without this checking, we will run into a TIMEOUT request because
http_redirect_fetch will return immediately when location doesn't exist.
  • Loading branch information
CYBAI committed May 9, 2020
commit b4089bcd07859f66c39aae986dad44d67332849b
@@ -7,7 +7,7 @@
//! response is received, it is forwarded to the appropriate script thread.

use crossbeam_channel::Sender;
use http::header::LOCATION;
use http::HeaderMap;
use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
use msg::constellation_msg::PipelineId;
@@ -98,8 +98,12 @@ impl NetworkListener {
FetchMetadata::Unfiltered(ref m) => m,
};

match metadata.headers {
Some(ref headers) if headers.contains_key(LOCATION) => {
match metadata.location_url {
// https://html.spec.whatwg.org/multipage/#process-a-navigate-fetch
// Step 7-4.
Some(Ok(ref location_url))
if matches!(location_url.scheme(), "http" | "https") =>
{
if self.request_builder.url_list.is_empty() {
self.request_builder
.url_list
@@ -115,10 +119,16 @@ impl NetworkListener {
.map(|referrer_url| Referrer::ReferrerUrl(referrer_url));
self.request_builder.referrer_policy = metadata.referrer_policy;

let headers = if let Some(ref headers) = metadata.headers {
headers.clone().into_inner()
} else {
HeaderMap::new()
};

self.res_init = Some(ResponseInit {
url: metadata.final_url.clone(),
location_url: metadata.location_url.clone(),
headers: headers.clone().into_inner(),
headers,
referrer: metadata.referrer.clone(),
status_code: metadata
.status
@@ -132,7 +142,7 @@ impl NetworkListener {
//
// Ideally the Fetch code would handle manual redirects on its own
self.initiate_fetch(None);
},
}

This comment has been minimized.

Copy link
@CYBAI

CYBAI May 8, 2020

Author Collaborator

hmm, I suspect this is a regression from rustfmt? 🤔

_ => {
// Response should be processed by script thread.
self.should_send = true;
@@ -1,2 +1,67 @@
[domain-tests.html]
expected: TIMEOUT
[domain0036 - domain0036]
expected: FAIL

[domain0035 - domain0035]
expected: FAIL

[domain0029 - domain0029]
expected: FAIL

[domain0022 - domain0022]
expected: FAIL

[domain0005 - domain0005]
expected: FAIL

[optional-domain0041 - optional-domain0041]
expected: FAIL

[domain0003 - domain0003]
expected: FAIL

[domain0019 - domain0019]
expected: FAIL

[domain0040 - domain0040]
expected: FAIL

[domain0025 - domain0025]
expected: FAIL

[domain0020 - domain0020]
expected: FAIL

[domain0001 - domain0001]
expected: FAIL

[domain0038 - domain0038]
expected: FAIL

[domain0039 - domain0039]
expected: FAIL

[domain0033 - domain0033]
expected: FAIL

[domain0031 - domain0031]
expected: FAIL

[domain0023 - domain0023]
expected: FAIL

[domain0012 - domain0012]
expected: FAIL

[domain0008 - domain0008]
expected: FAIL

[domain0009 - domain0009]
expected: FAIL

[domain0026 - domain0026]
expected: FAIL

[domain0004 - domain0004]
expected: FAIL

@@ -1,2 +1,4 @@
[ordering-tests.html]
expected: TIMEOUT
[ordering0001 - ordering0001]
expected: FAIL

@@ -1,2 +1,40 @@
[path-tests.html]
expected: TIMEOUT
[path0015 - path0015]
expected: FAIL

[path0002 - path0002]
expected: FAIL

[path0003 - path0003]
expected: FAIL

[path0004 - path0004]
expected: FAIL

[path0001 - path0001]
expected: FAIL

[path0016 - path0016]
expected: FAIL

[path0026 - path0026]
expected: FAIL

[path0017 - path0017]
expected: FAIL

[path0032 - path0032]
expected: FAIL

[path0029 - path0029]
expected: FAIL

[disabled-path0029 - disabled-path0029]
expected: FAIL

[path0010 - path0010]
expected: FAIL

[path0007 - path0007]
expected: FAIL

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.