mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Remove the HttpRequestFactory trait.
This commit is contained in:
parent
38db554b5e
commit
fc6fa56af5
1 changed files with 12 additions and 21 deletions
|
@ -144,19 +144,11 @@ impl HttpResponse for WrappedHttpResponse {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trait HttpRequestFactory {
|
|
||||||
type R: HttpRequest;
|
|
||||||
|
|
||||||
fn create(&self, url: ServoUrl, method: Method, headers: Headers) -> Result<Self::R, LoadError>;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct NetworkHttpRequestFactory {
|
struct NetworkHttpRequestFactory {
|
||||||
pub connector: Arc<Pool<Connector>>,
|
pub connector: Arc<Pool<Connector>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HttpRequestFactory for NetworkHttpRequestFactory {
|
impl NetworkHttpRequestFactory {
|
||||||
type R = WrappedHttpRequest;
|
|
||||||
|
|
||||||
fn create(&self, url: ServoUrl, method: Method, headers: Headers)
|
fn create(&self, url: ServoUrl, method: Method, headers: Headers)
|
||||||
-> Result<WrappedHttpRequest, LoadError> {
|
-> Result<WrappedHttpRequest, LoadError> {
|
||||||
let connection = HyperRequest::with_connector(method,
|
let connection = HyperRequest::with_connector(method,
|
||||||
|
@ -518,18 +510,17 @@ fn auth_from_cache(auth_cache: &Arc<RwLock<AuthCache>>, origin: &UrlOrigin) -> O
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn obtain_response<A>(request_factory: &HttpRequestFactory<R=A>,
|
fn obtain_response(request_factory: &NetworkHttpRequestFactory,
|
||||||
url: &ServoUrl,
|
url: &ServoUrl,
|
||||||
method: &Method,
|
method: &Method,
|
||||||
request_headers: &Headers,
|
request_headers: &Headers,
|
||||||
data: &Option<Vec<u8>>,
|
data: &Option<Vec<u8>>,
|
||||||
load_data_method: &Method,
|
load_data_method: &Method,
|
||||||
pipeline_id: &Option<PipelineId>,
|
pipeline_id: &Option<PipelineId>,
|
||||||
iters: u32,
|
iters: u32,
|
||||||
request_id: Option<&str>,
|
request_id: Option<&str>,
|
||||||
is_xhr: bool)
|
is_xhr: bool)
|
||||||
-> Result<(A::R, Option<ChromeToDevtoolsControlMsg>), LoadError>
|
-> Result<(WrappedHttpResponse, Option<ChromeToDevtoolsControlMsg>), LoadError> {
|
||||||
where A: HttpRequest + 'static {
|
|
||||||
let null_data = None;
|
let null_data = None;
|
||||||
let response;
|
let response;
|
||||||
let connection_url = replace_hosts(&url);
|
let connection_url = replace_hosts(&url);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue