Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

Commit

Permalink
Fix deprecated warning
Browse files Browse the repository at this point in the history
```
warning: use of deprecated method `async_rustls::rustls::RootCertStore::add_server_trust_anchors`: Please use `add_trust_anchors` instead
```
  • Loading branch information
taiki-e committed Aug 5, 2023
1 parent 35c21dd commit 35425cd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
18 changes: 8 additions & 10 deletions examples/client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,15 @@ fn main() -> io::Result<()> {
ta.name_constraints,
)
});
root_cert_store.add_server_trust_anchors(trust_anchors);
root_cert_store.add_trust_anchors(trust_anchors);
} else {
root_cert_store.add_server_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.iter().map(
|ta| {
OwnedTrustAnchor::from_subject_spki_name_constraints(
ta.subject,
ta.spki,
ta.name_constraints,
)
},
));
root_cert_store.add_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.iter().map(|ta| {
OwnedTrustAnchor::from_subject_spki_name_constraints(
ta.subject,
ta.spki,
ta.name_constraints,
)
}));
}

let config = rustls::ClientConfig::builder()
Expand Down
4 changes: 2 additions & 2 deletions tests/badssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async fn get(
fn test_tls12() -> io::Result<()> {
smol::block_on(async {
let mut root_store = rustls::RootCertStore::empty();
root_store.add_server_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.iter().map(|ta| {
root_store.add_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.iter().map(|ta| {
OwnedTrustAnchor::from_subject_spki_name_constraints(
ta.subject,
ta.spki,
Expand Down Expand Up @@ -76,7 +76,7 @@ fn test_tls13() {
fn test_modern() -> io::Result<()> {
smol::block_on(async {
let mut root_store = rustls::RootCertStore::empty();
root_store.add_server_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.iter().map(|ta| {
root_store.add_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.iter().map(|ta| {
OwnedTrustAnchor::from_subject_spki_name_constraints(
ta.subject,
ta.spki,
Expand Down
4 changes: 2 additions & 2 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ fn pass() -> io::Result<()> {
)
});
let mut root_store = rustls::RootCertStore::empty();
root_store.add_server_trust_anchors(trust_anchors.into_iter());
root_store.add_trust_anchors(trust_anchors.into_iter());
let config = rustls::ClientConfig::builder()
.with_safe_defaults()
.with_root_certificates(root_store)
Expand Down Expand Up @@ -140,7 +140,7 @@ fn fail() -> io::Result<()> {
)
});
let mut root_store = rustls::RootCertStore::empty();
root_store.add_server_trust_anchors(trust_anchors.into_iter());
root_store.add_trust_anchors(trust_anchors.into_iter());
let config = rustls::ClientConfig::builder()
.with_safe_defaults()
.with_root_certificates(root_store)
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ mod utils {
ta.name_constraints,
)
});
client_root_cert_store.add_server_trust_anchors(trust_anchors.into_iter());
client_root_cert_store.add_trust_anchors(trust_anchors.into_iter());
let cconfig = ClientConfig::builder()
.with_safe_defaults()
.with_root_certificates(client_root_cert_store)
Expand Down

0 comments on commit 35425cd

Please sign in to comment.