mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Passes an Arc<Mutex<HSTSList>> to threads instead of cloning
This commit is contained in:
parent
11f5be6d85
commit
82cafc4274
2 changed files with 9 additions and 7 deletions
|
@ -24,6 +24,7 @@ use std::error::Error;
|
|||
use openssl::ssl::{SslContext, SslMethod, SSL_VERIFY_PEER};
|
||||
use std::io::{self, Read, Write};
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
use std::sync::mpsc::{Sender, channel};
|
||||
use util::task::spawn_named;
|
||||
use util::resource_files::resources_dir_path;
|
||||
|
@ -36,7 +37,7 @@ use std::boxed::FnBox;
|
|||
|
||||
pub fn factory(cookies_chan: Sender<ControlMsg>,
|
||||
devtools_chan: Option<Sender<DevtoolsControlMsg>>,
|
||||
hsts_list: HSTSList)
|
||||
hsts_list: Arc<Mutex<HSTSList>>)
|
||||
-> Box<FnBox(LoadData, LoadConsumer, Arc<MIMEClassifier>) + Send> {
|
||||
box move |load_data, senders, classifier| {
|
||||
spawn_named("http_loader".to_owned(),
|
||||
|
@ -86,7 +87,7 @@ fn load(mut load_data: LoadData,
|
|||
classifier: Arc<MIMEClassifier>,
|
||||
cookies_chan: Sender<ControlMsg>,
|
||||
devtools_chan: Option<Sender<DevtoolsControlMsg>>,
|
||||
hsts_list: HSTSList) {
|
||||
hsts_list: Arc<Mutex<HSTSList>>) {
|
||||
// FIXME: At the time of writing this FIXME, servo didn't have any central
|
||||
// location for configuration. If you're reading this and such a
|
||||
// repository DOES exist, please update this constant to use it.
|
||||
|
@ -117,7 +118,7 @@ fn load(mut load_data: LoadData,
|
|||
loop {
|
||||
iters = iters + 1;
|
||||
|
||||
if request_must_be_secured(&hsts_list, &url) {
|
||||
if request_must_be_secured(&hsts_list.lock().unwrap(), &url) {
|
||||
info!("{} is in the strict transport security list, requesting secure host", url);
|
||||
url = secure_url(&url);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue