Auto merge of #14106 - servo:deindent-http-network-fetch, r=nox

Deindent some of the code in http_network_fetch.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14106)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-11-08 00:03:24 -06:00 committed by GitHub
commit 32a953f0ba

View file

@ -1015,9 +1015,20 @@ fn http_network_fetch<UI: 'static + UIProvider>(request: Rc<Request>,
request_id.as_ref().map(Deref::deref), is_xhr);
let pipeline_id = request.pipeline_id.get();
let (res, msg) = match wrapped_response {
Ok(wrapped_response) => wrapped_response,
Err(error) => {
let error = match error.error {
LoadErrorType::ConnectionAborted { .. } => unreachable!(),
LoadErrorType::Ssl { reason } => NetworkError::SslValidation(error.url, reason),
LoadErrorType::Cancelled => NetworkError::LoadCancelled,
e => NetworkError::Internal(e.description().to_owned())
};
return Response::network_error(error);
}
};
let mut response = Response::new();
match wrapped_response {
Ok((res, msg)) => {
response.url = Some(url.clone());
response.status = Some(res.response.status);
response.raw_status = Some((res.response.status_raw().0,
@ -1096,17 +1107,6 @@ fn http_network_fetch<UI: 'static + UIProvider>(request: Rc<Request>,
}
}
});
},
Err(error) => {
let error = match error.error {
LoadErrorType::ConnectionAborted { .. } => unreachable!(),
LoadErrorType::Ssl { reason } => NetworkError::SslValidation(error.url, reason),
LoadErrorType::Cancelled => NetworkError::LoadCancelled,
e => NetworkError::Internal(e.description().to_owned())
};
return Response::network_error(error);
}
};
// TODO these substeps aren't possible yet
// Substep 1