From fc6fa56af57dab4a20fa788c5ebe444e23808a3a Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Tue, 22 Nov 2016 09:13:21 +0100 Subject: [PATCH] Remove the HttpRequestFactory trait. --- components/net/http_loader.rs | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index b4db6a18627e..19420722c799 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -144,19 +144,11 @@ impl HttpResponse for WrappedHttpResponse { } } -trait HttpRequestFactory { - type R: HttpRequest; - - fn create(&self, url: ServoUrl, method: Method, headers: Headers) -> Result; -} - struct NetworkHttpRequestFactory { pub connector: Arc>, } -impl HttpRequestFactory for NetworkHttpRequestFactory { - type R = WrappedHttpRequest; - +impl NetworkHttpRequestFactory { fn create(&self, url: ServoUrl, method: Method, headers: Headers) -> Result { let connection = HyperRequest::with_connector(method, @@ -518,18 +510,17 @@ fn auth_from_cache(auth_cache: &Arc>, origin: &UrlOrigin) -> O } } -fn obtain_response(request_factory: &HttpRequestFactory, - url: &ServoUrl, - method: &Method, - request_headers: &Headers, - data: &Option>, - load_data_method: &Method, - pipeline_id: &Option, - iters: u32, - request_id: Option<&str>, - is_xhr: bool) - -> Result<(A::R, Option), LoadError> - where A: HttpRequest + 'static { +fn obtain_response(request_factory: &NetworkHttpRequestFactory, + url: &ServoUrl, + method: &Method, + request_headers: &Headers, + data: &Option>, + load_data_method: &Method, + pipeline_id: &Option, + iters: u32, + request_id: Option<&str>, + is_xhr: bool) + -> Result<(WrappedHttpResponse, Option), LoadError> { let null_data = None; let response; let connection_url = replace_hosts(&url);