mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
if let destructuring
This commit is contained in:
parent
49ea36399d
commit
733019e029
1 changed files with 9 additions and 7 deletions
|
@ -831,7 +831,7 @@ pub fn http_fetch(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Substep 2-3.
|
// Substep 2-3.
|
||||||
let location = response
|
let mut location = response
|
||||||
.actual_response()
|
.actual_response()
|
||||||
.headers
|
.headers
|
||||||
.get(header::LOCATION)
|
.get(header::LOCATION)
|
||||||
|
@ -845,13 +845,15 @@ pub fn http_fetch(
|
||||||
});
|
});
|
||||||
|
|
||||||
// Substep 4.
|
// Substep 4.
|
||||||
response.actual_response_mut().location_url = location.map(|res| res.map(|mut url| {
|
if let Some(ref mut location) = location {
|
||||||
|
if let Ok(ref mut location) = location {
|
||||||
|
if location.fragment().is_none() {
|
||||||
let current_url = request.current_url();
|
let current_url = request.current_url();
|
||||||
match (current_url.fragment(), url.fragment()) {
|
location.set_fragment(current_url.fragment());
|
||||||
(fragment @ Some(..), None) => { url.set_fragment(fragment); url },
|
|
||||||
_ => url
|
|
||||||
}
|
}
|
||||||
}));
|
}
|
||||||
|
}
|
||||||
|
response.actual_response_mut().location_url = location;
|
||||||
|
|
||||||
// Substep 5.
|
// Substep 5.
|
||||||
response = match request.redirect_mode {
|
response = match request.redirect_mode {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue