Relay local changes while testing

This commit is contained in:
Rafael Caricio 2023-08-10 22:16:18 +02:00
parent 73b429ab51
commit 6ec9e61364
Signed by: rafaelcaricio
GPG key ID: 3C86DBCE8E93C947
2 changed files with 14 additions and 0 deletions

View file

@ -59,6 +59,7 @@ ring = "0.16.20"
rsa = { version = "0.9" }
rsa-magic-public-key = "0.8.0"
rustls = "0.20.7"
rustls-native-certs = "0.6.3"
rustls-pemfile = "1.0.1"
serde = { version = "1.0", features = ["derive"] }
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(|| {
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()
.connector(connector)
.wrap(Tracing)
.add_default_header(("User-Agent", user_agent.to_string()))
.timeout(Duration::from_secs(timeout_seconds))
.connector(awc::Connector::new().rustls(Arc::new(config)))
.finish()
})
.clone()