mirror of
https://github.com/servo/servo.git
synced 2025-07-26 00:30:22 +01:00
Reuse the http connector pool between fetches
This commit is contained in:
parent
9d320d5a34
commit
ed075ab552
2 changed files with 5 additions and 2 deletions
|
@ -72,6 +72,7 @@ pub struct HttpState {
|
||||||
pub cookie_jar: Arc<RwLock<CookieStorage>>,
|
pub cookie_jar: Arc<RwLock<CookieStorage>>,
|
||||||
pub auth_cache: Arc<RwLock<AuthCache>>,
|
pub auth_cache: Arc<RwLock<AuthCache>>,
|
||||||
pub blocked_content: Arc<Option<RuleList>>,
|
pub blocked_content: Arc<Option<RuleList>>,
|
||||||
|
pub connector_pool: Arc<Pool<Connector>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HttpState {
|
impl HttpState {
|
||||||
|
@ -81,6 +82,7 @@ impl HttpState {
|
||||||
cookie_jar: Arc::new(RwLock::new(CookieStorage::new(150))),
|
cookie_jar: Arc::new(RwLock::new(CookieStorage::new(150))),
|
||||||
auth_cache: Arc::new(RwLock::new(AuthCache::new())),
|
auth_cache: Arc::new(RwLock::new(AuthCache::new())),
|
||||||
blocked_content: Arc::new(None),
|
blocked_content: Arc::new(None),
|
||||||
|
connector_pool: create_http_connector(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1021,15 +1023,15 @@ fn http_network_fetch(request: Rc<Request>,
|
||||||
|
|
||||||
// Step 2
|
// Step 2
|
||||||
// TODO be able to create connection using current url's origin and credentials
|
// TODO be able to create connection using current url's origin and credentials
|
||||||
let connection = create_http_connector();
|
|
||||||
|
|
||||||
// Step 3
|
// Step 3
|
||||||
// TODO be able to tell if the connection is a failure
|
// TODO be able to tell if the connection is a failure
|
||||||
|
|
||||||
// Step 4
|
// Step 4
|
||||||
let factory = NetworkHttpRequestFactory {
|
let factory = NetworkHttpRequestFactory {
|
||||||
connector: connection,
|
connector: context.state.connector_pool.clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let url = request.current_url();
|
let url = request.current_url();
|
||||||
|
|
||||||
let request_id = context.devtools_chan.as_ref().map(|_| {
|
let request_id = context.devtools_chan.as_ref().map(|_| {
|
||||||
|
|
|
@ -325,6 +325,7 @@ impl CoreResourceManager {
|
||||||
cookie_jar: group.cookie_jar.clone(),
|
cookie_jar: group.cookie_jar.clone(),
|
||||||
auth_cache: group.auth_cache.clone(),
|
auth_cache: group.auth_cache.clone(),
|
||||||
blocked_content: BLOCKED_CONTENT_RULES.clone(),
|
blocked_content: BLOCKED_CONTENT_RULES.clone(),
|
||||||
|
connector_pool: group.connector.clone(),
|
||||||
};
|
};
|
||||||
let ua = self.user_agent.clone();
|
let ua = self.user_agent.clone();
|
||||||
let dc = self.devtools_chan.clone();
|
let dc = self.devtools_chan.clone();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue