Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify the http_loader code. #14362

Merged
merged 14 commits into from Nov 26, 2016
Prev

Remove WrappedHttpRequest.

  • Loading branch information
Ms2ger committed Nov 24, 2016
commit 7192a747f2a5584fd950962d455849844d52ee68
@@ -129,7 +129,7 @@ struct NetworkHttpRequestFactory {

impl NetworkHttpRequestFactory {
fn create(&self, url: ServoUrl, method: Method, headers: Headers)
-> Result<WrappedHttpRequest, LoadError> {
-> Result<HyperRequest<Fresh>, LoadError> {
let connection = HyperRequest::with_connector(method,
url.clone().into_url().unwrap(),
&*self.connector);
@@ -164,14 +164,10 @@ impl NetworkHttpRequestFactory {
};
*request.headers_mut() = headers;

Ok(WrappedHttpRequest { request: request })
Ok(request)
}
}

pub struct WrappedHttpRequest {
request: HyperRequest<Fresh>
}

#[derive(Debug)]
struct LoadError {
pub url: ServoUrl,
@@ -490,14 +486,14 @@ fn obtain_response(request_factory: &NetworkHttpRequestFactory,

let connect_start = precise_time_ms();

let req = try!(request_factory.create(connection_url.clone(), method.clone(),
headers.clone()));
let request = try!(request_factory.create(connection_url.clone(), method.clone(),
headers.clone()));

let connect_end = precise_time_ms();

let send_start = precise_time_ms();

let mut request_writer = match req.request.start() {
let mut request_writer = match request.start() {
Ok(streaming) => streaming,
Err(e) => return Err(LoadError::new(connection_url,
LoadErrorType::Connection { reason: e.description().to_owned() })),
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.