aboutsummaryrefslogtreecommitdiffstats
path: root/components/net/fetch/request.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/net/fetch/request.rs')
-rw-r--r--components/net/fetch/request.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/components/net/fetch/request.rs b/components/net/fetch/request.rs
index c6fe52ed135..c5e1a4a5f59 100644
--- a/components/net/fetch/request.rs
+++ b/components/net/fetch/request.rs
@@ -116,7 +116,7 @@ pub struct Request {
}
impl Request {
- pub fn new(url: Url, context: Context, isServiceWorkerGlobalScope: bool) -> Request {
+ pub fn new(url: Url, context: Context, is_service_worker_global_scope: bool) -> Request {
Request {
method: Method::Get,
url: url,
@@ -124,7 +124,7 @@ impl Request {
unsafe_request: false,
body: None,
preserve_content_codings: false,
- is_service_worker_global_scope: isServiceWorkerGlobalScope,
+ is_service_worker_global_scope: is_service_worker_global_scope,
skip_service_worker: false,
context: context,
context_frame_type: ContextFrameType::ContextNone,
@@ -312,14 +312,14 @@ impl Request {
if !response.headers.has::<Location>() {
return response;
}
- let location = response.headers.get::<Location>();
- if location.is_none() {
- return Response::network_error();
- }
+ let location = match response.headers.get::<Location>() {
+ None => return Response::network_error(),
+ Some(location) => location,
+ };
// Step 5
- let locationUrl = Url::parse(location.unwrap());
+ let location_url = Url::parse(location);
// Step 6
- let locationUrl = match locationUrl {
+ let location_url = match location_url {
Ok(url) => url,
Err(_) => return Response::network_error()
};
@@ -335,10 +335,10 @@ impl Request {
if self.redirect_mode == RedirectMode::Follow {
// FIXME: Origin method of the Url crate hasn't been implemented (https://github.com/servo/rust-url/issues/54)
// Substep 1
- // if cors_flag && locationUrl.origin() != self.url.origin() { self.origin = None; }
+ // if cors_flag && location_url.origin() != self.url.origin() { self.origin = None; }
// Substep 2
- if cors_flag && (!locationUrl.username().unwrap_or("").is_empty() ||
- locationUrl.password().is_some()) {
+ if cors_flag && (!location_url.username().unwrap_or("").is_empty() ||
+ location_url.password().is_some()) {
return Response::network_error();
}
// Substep 3
@@ -348,7 +348,7 @@ impl Request {
self.method = Method::Get;
}
// Substep 4
- self.url = locationUrl;
+ self.url = location_url;
// Substep 5
return self.fetch(cors_flag);
}