mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Rustfmt has changed its default style :/
This commit is contained in:
parent
82fc6d9f49
commit
be69f9c3e6
207 changed files with 1200 additions and 1339 deletions
|
@ -2,8 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use brotli::Decompressor;
|
||||
use bytes::Bytes;
|
||||
use crate::connector::{create_http_client, Connector, WrappedBody, BUF_SIZE};
|
||||
use crate::cookie;
|
||||
use crate::cookie_storage::CookieStorage;
|
||||
|
@ -15,6 +13,8 @@ use crate::fetch::methods::{Data, DoneChannel, FetchContext, Target};
|
|||
use crate::hsts::HstsList;
|
||||
use crate::http_cache::HttpCache;
|
||||
use crate::resource_thread::AuthCache;
|
||||
use brotli::Decompressor;
|
||||
use bytes::Bytes;
|
||||
use crossbeam_channel::{unbounded, Sender};
|
||||
use devtools_traits::{
|
||||
ChromeToDevtoolsControlMsg, DevtoolsControlMsg, HttpRequest as DevtoolsHttpRequest,
|
||||
|
@ -684,13 +684,13 @@ pub fn http_redirect_fetch(
|
|||
Some(Err(err)) => {
|
||||
return Response::network_error(NetworkError::Internal(
|
||||
"Location URL parse failure: ".to_owned() + &err,
|
||||
))
|
||||
));
|
||||
},
|
||||
// Step 4
|
||||
Some(Ok(ref url)) if !matches!(url.scheme(), "http" | "https") => {
|
||||
return Response::network_error(NetworkError::Internal(
|
||||
"Location URL not an HTTP(S) scheme".into(),
|
||||
))
|
||||
));
|
||||
},
|
||||
Some(Ok(url)) => url,
|
||||
};
|
||||
|
@ -749,7 +749,8 @@ pub fn http_redirect_fetch(
|
|||
((*code == StatusCode::MOVED_PERMANENTLY || *code == StatusCode::FOUND) &&
|
||||
request.method == Method::POST) ||
|
||||
(*code == StatusCode::SEE_OTHER && request.method != Method::HEAD)
|
||||
}) {
|
||||
})
|
||||
{
|
||||
request.method = Method::GET;
|
||||
request.body = None;
|
||||
}
|
||||
|
@ -1069,10 +1070,11 @@ fn http_network_or_cache_fetch(
|
|||
}
|
||||
}
|
||||
// Substep 4
|
||||
if revalidating_flag && forward_response
|
||||
.status
|
||||
.as_ref()
|
||||
.map_or(false, |s| s.0 == StatusCode::NOT_MODIFIED)
|
||||
if revalidating_flag &&
|
||||
forward_response
|
||||
.status
|
||||
.as_ref()
|
||||
.map_or(false, |s| s.0 == StatusCode::NOT_MODIFIED)
|
||||
{
|
||||
if let Ok(mut http_cache) = context.state.http_cache.write() {
|
||||
response = http_cache.refresh(&http_request, forward_response.clone(), done_chan);
|
||||
|
@ -1416,10 +1418,11 @@ fn cors_preflight_fetch(
|
|||
let response = http_network_or_cache_fetch(&mut preflight, false, false, &mut None, context);
|
||||
|
||||
// Step 6
|
||||
if cors_check(&request, &response).is_ok() && response
|
||||
.status
|
||||
.as_ref()
|
||||
.map_or(false, |(status, _)| status.is_success())
|
||||
if cors_check(&request, &response).is_ok() &&
|
||||
response
|
||||
.status
|
||||
.as_ref()
|
||||
.map_or(false, |(status, _)| status.is_success())
|
||||
{
|
||||
// Substep 1, 2
|
||||
let mut methods = if response
|
||||
|
@ -1432,7 +1435,7 @@ fn cors_preflight_fetch(
|
|||
None => {
|
||||
return Response::network_error(NetworkError::Internal(
|
||||
"CORS ACAM check failed".into(),
|
||||
))
|
||||
));
|
||||
},
|
||||
}
|
||||
} else {
|
||||
|
@ -1450,7 +1453,7 @@ fn cors_preflight_fetch(
|
|||
None => {
|
||||
return Response::network_error(NetworkError::Internal(
|
||||
"CORS ACAH check failed".into(),
|
||||
))
|
||||
));
|
||||
},
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue