Introduce create_ssl_client

This lets us reuse the same SSL context for all HTTPS requests.
This commit is contained in:
Anthony Ramine 2017-04-02 15:14:19 +02:00
parent ecd9ac9b68
commit 20e0b6cd56
3 changed files with 17 additions and 9 deletions

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use brotli::Decompressor;
use connector::{Connector, create_http_connector};
use connector::{Connector, create_http_connector, create_ssl_client};
use cookie;
use cookie_storage::CookieStorage;
use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg, HttpRequest as DevtoolsHttpRequest};
@ -75,11 +75,12 @@ pub struct HttpState {
impl HttpState {
pub fn new(certificate_path: &str) -> HttpState {
let ssl_client = create_ssl_client(certificate_path);
HttpState {
hsts_list: Arc::new(RwLock::new(HstsList::new())),
cookie_jar: Arc::new(RwLock::new(CookieStorage::new(150))),
auth_cache: Arc::new(RwLock::new(AuthCache::new())),
connector_pool: create_http_connector(certificate_path),
connector_pool: create_http_connector(ssl_client),
}
}
}