Revert "chore: upgrade to reqwest 0.12.4 and rustls 0.22 (#24056)" (#24262)

This reverts commit fb31eaa9ca.

Reverting because users reported spurious errors when downloading
dependencies - https://github.com/denoland/deno/issues/24260.

Closes https://github.com/denoland/deno/issues/24260
This commit is contained in:
Bartek Iwańczuk 2024-06-19 15:09:17 +01:00 committed by GitHub
parent f4eead61eb
commit b94707af7d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 656 additions and 396 deletions

View file

@ -696,13 +696,21 @@ pub fn get_root_cert_store(
for store in ca_stores.iter() {
match store.as_str() {
"mozilla" => {
root_cert_store.extend(webpki_roots::TLS_SERVER_ROOTS.to_vec());
root_cert_store.add_trust_anchors(
webpki_roots::TLS_SERVER_ROOTS.iter().map(|ta| {
rustls::OwnedTrustAnchor::from_subject_spki_name_constraints(
ta.subject,
ta.spki,
ta.name_constraints,
)
}),
);
}
"system" => {
let roots = load_native_certs().expect("could not load platform certs");
for root in roots {
root_cert_store
.add(rustls::pki_types::CertificateDer::from(root.0))
.add(&rustls::Certificate(root.0))
.expect("Failed to add platform cert to root cert store");
}
}
@ -726,17 +734,17 @@ pub fn get_root_cert_store(
RootCertStoreLoadError::CaFileOpenError(err.to_string())
})?;
let mut reader = BufReader::new(certfile);
rustls_pemfile::certs(&mut reader).collect::<Result<Vec<_>, _>>()
rustls_pemfile::certs(&mut reader)
}
CaData::Bytes(data) => {
let mut reader = BufReader::new(Cursor::new(data));
rustls_pemfile::certs(&mut reader).collect::<Result<Vec<_>, _>>()
rustls_pemfile::certs(&mut reader)
}
};
match result {
Ok(certs) => {
root_cert_store.add_parsable_certificates(certs);
root_cert_store.add_parsable_certificates(&certs);
}
Err(e) => {
return Err(RootCertStoreLoadError::FailedAddPemFile(e.to_string()));