Compare commits

...

1 commit

Author SHA1 Message Date
6ec9e61364
Relay local changes while testing 2023-08-10 22:16:18 +02:00
2 changed files with 14 additions and 0 deletions

View file

@ -59,6 +59,7 @@ ring = "0.16.20"
rsa = { version = "0.9" } rsa = { version = "0.9" }
rsa-magic-public-key = "0.8.0" rsa-magic-public-key = "0.8.0"
rustls = "0.20.7" rustls = "0.20.7"
rustls-native-certs = "0.6.3"
rustls-pemfile = "1.0.1" rustls-pemfile = "1.0.1"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"

View file

@ -172,11 +172,24 @@ pub(crate) fn build_client(user_agent: &str, pool_size: usize, timeout_seconds:
.get_or_init(|| { .get_or_init(|| {
let connector = Connector::new().limit(pool_size); let connector = Connector::new().limit(pool_size);
let mut roots = rustls::RootCertStore::empty();
for cert in rustls_native_certs::load_native_certs().expect("could not load platform certs") {
roots
.add(&rustls::Certificate(cert.0))
.unwrap();
}
let config = rustls::ClientConfig::builder()
.with_safe_defaults()
.with_root_certificates(roots)
.with_no_client_auth();
Client::builder() Client::builder()
.connector(connector) .connector(connector)
.wrap(Tracing) .wrap(Tracing)
.add_default_header(("User-Agent", user_agent.to_string())) .add_default_header(("User-Agent", user_agent.to_string()))
.timeout(Duration::from_secs(timeout_seconds)) .timeout(Duration::from_secs(timeout_seconds))
.connector(awc::Connector::new().rustls(Arc::new(config)))
.finish() .finish()
}) })
.clone() .clone()