mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Convert NetworkHttpRequestFactory.
This commit is contained in:
parent
80eaeac9f4
commit
0e1703d747
1 changed files with 4 additions and 2 deletions
|
@ -268,7 +268,8 @@ pub struct NetworkHttpRequestFactory {
|
|||
impl HttpRequestFactory for NetworkHttpRequestFactory {
|
||||
type R = WrappedHttpRequest;
|
||||
|
||||
fn create(&self, url: Url, method: Method) -> Result<WrappedHttpRequest, LoadError> {
|
||||
fn create_with_headers(&self, url: Url, method: Method, headers: Headers)
|
||||
-> Result<WrappedHttpRequest, LoadError> {
|
||||
let connection = Request::with_connector(method, url.clone(), &*self.connector);
|
||||
|
||||
if let Err(HttpError::Ssl(ref error)) = connection {
|
||||
|
@ -283,13 +284,14 @@ impl HttpRequestFactory for NetworkHttpRequestFactory {
|
|||
}
|
||||
}
|
||||
|
||||
let request = match connection {
|
||||
let mut request = match connection {
|
||||
Ok(req) => req,
|
||||
|
||||
Err(e) => {
|
||||
return Err(LoadError::Connection(url, e.description().to_owned()))
|
||||
}
|
||||
};
|
||||
*request.headers_mut() = headers;
|
||||
|
||||
Ok(WrappedHttpRequest { request: request })
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue