aboutsummaryrefslogtreecommitdiffstats
path: root/components/net/resource_thread.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2020-05-27 19:24:06 -0400
committerJosh Matthews <josh@joshmatthews.net>2020-06-09 15:03:18 -0400
commit1cdaf40eb24c26bc2d372a791ffb9a6a08d7a304 (patch)
treeda3773c90431128a60d219356d143e7b865cb3f1 /components/net/resource_thread.rs
parentb7a640b5172ebcdea73179c5a33486930ef35e96 (diff)
downloadservo-1cdaf40eb24c26bc2d372a791ffb9a6a08d7a304.tar.gz
servo-1cdaf40eb24c26bc2d372a791ffb9a6a08d7a304.zip
net: Add an SSL verification callback to support checking a dynamic list of certs.
Diffstat (limited to 'components/net/resource_thread.rs')
-rw-r--r--components/net/resource_thread.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/components/net/resource_thread.rs b/components/net/resource_thread.rs
index 28a397e78e6..10a83fbc04c 100644
--- a/components/net/resource_thread.rs
+++ b/components/net/resource_thread.rs
@@ -4,7 +4,7 @@
//! A thread that takes a URL and streams back the binary data.
-use crate::connector::{create_http_client, create_tls_config, ALPN_H2_H1};
+use crate::connector::{create_http_client, create_tls_config, ExtraCerts, ALPN_H2_H1};
use crate::cookie;
use crate::cookie_storage::CookieStorage;
use crate::fetch::cors_cache::CorsCache;
@@ -127,7 +127,7 @@ struct ResourceChannelManager {
fn create_http_states(
config_dir: Option<&Path>,
certificate_path: Option<String>,
-) -> (Arc<HttpState>, Arc<HttpState>) {
+) -> (Arc<HttpState>, Arc<HttpState>, ExtraCerts) {
let mut hsts_list = HstsList::from_servo_preload();
let mut auth_cache = AuthCache::new();
let http_cache = HttpCache::new();
@@ -143,6 +143,8 @@ fn create_http_states(
None => resources::read_string(Resource::SSLCertificates),
};
+ let extra_certs = ExtraCerts::new();
+
let http_state = HttpState {
hsts_list: RwLock::new(hsts_list),
cookie_jar: RwLock::new(cookie_jar),
@@ -151,7 +153,7 @@ fn create_http_states(
http_cache: RwLock::new(http_cache),
http_cache_state: Mutex::new(HashMap::new()),
client: create_http_client(
- create_tls_config(&certs, ALPN_H2_H1),
+ create_tls_config(&certs, ALPN_H2_H1, extra_certs.clone()),
HANDLE.lock().unwrap().as_ref().unwrap().executor(),
),
};
@@ -164,12 +166,16 @@ fn create_http_states(
http_cache: RwLock::new(HttpCache::new()),
http_cache_state: Mutex::new(HashMap::new()),
client: create_http_client(
- create_tls_config(&certs, ALPN_H2_H1),
+ create_tls_config(&certs, ALPN_H2_H1, extra_certs.clone()),
HANDLE.lock().unwrap().as_ref().unwrap().executor(),
),
};
- (Arc::new(http_state), Arc::new(private_http_state))
+ (
+ Arc::new(http_state),
+ Arc::new(private_http_state),
+ extra_certs,
+ )
}
impl ResourceChannelManager {
@@ -180,7 +186,7 @@ impl ResourceChannelManager {
private_receiver: IpcReceiver<CoreResourceMsg>,
memory_reporter: IpcReceiver<ReportsChan>,
) {
- let (public_http_state, private_http_state) = create_http_states(
+ let (public_http_state, private_http_state, extra_certs) = create_http_states(
self.config_dir.as_ref().map(Deref::deref),
self.certificate_path.clone(),
);