mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
convert match to if let for location header check #7969
This commit is contained in:
parent
7b904ef6fb
commit
4b363d2a0e
1 changed files with 37 additions and 43 deletions
|
@ -635,11 +635,9 @@ pub fn load<A>(load_data: LoadData,
|
||||||
|
|
||||||
// --- Loop if there's a redirect
|
// --- Loop if there's a redirect
|
||||||
if response.status().class() == StatusClass::Redirection {
|
if response.status().class() == StatusClass::Redirection {
|
||||||
match response.headers().get::<Location>() {
|
if let Some(&Location(ref new_url)) = response.headers().get::<Location>() {
|
||||||
Some(&Location(ref new_url)) => {
|
|
||||||
// CORS (https://fetch.spec.whatwg.org/#http-fetch, status section, point 9, 10)
|
// CORS (https://fetch.spec.whatwg.org/#http-fetch, status section, point 9, 10)
|
||||||
match load_data.cors {
|
if let Some(ref c) = load_data.cors {
|
||||||
Some(ref c) => {
|
|
||||||
if c.preflight {
|
if c.preflight {
|
||||||
return Err(
|
return Err(
|
||||||
LoadError::Cors(
|
LoadError::Cors(
|
||||||
|
@ -650,8 +648,6 @@ pub fn load<A>(load_data: LoadData,
|
||||||
// but they don't seem necessary until credentials are implemented
|
// but they don't seem necessary until credentials are implemented
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
|
|
||||||
let new_doc_url = match UrlParser::new().base_url(&doc_url).parse(&new_url) {
|
let new_doc_url = match UrlParser::new().base_url(&doc_url).parse(&new_url) {
|
||||||
Ok(u) => u,
|
Ok(u) => u,
|
||||||
|
@ -679,8 +675,6 @@ pub fn load<A>(load_data: LoadData,
|
||||||
redirected_to.insert(doc_url.clone());
|
redirected_to.insert(doc_url.clone());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
None => ()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut adjusted_headers = response.headers().clone();
|
let mut adjusted_headers = response.headers().clone();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue