1
.github/workflows/test.yml
vendored
1
.github/workflows/test.yml
vendored
@@ -54,6 +54,7 @@ jobs:
|
|||||||
- charset
|
- charset
|
||||||
- cookies
|
- cookies
|
||||||
- socks-proxy
|
- socks-proxy
|
||||||
|
- native-certs
|
||||||
env:
|
env:
|
||||||
RUST_BACKTRACE: "1"
|
RUST_BACKTRACE: "1"
|
||||||
RUSTFLAGS: "-D dead_code -D unused-variables -D unused"
|
RUSTFLAGS: "-D dead_code -D unused-variables -D unused"
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ pub(crate) fn connect_https(unit: &Unit, hostname: &str) -> Result<Stream, Error
|
|||||||
|
|
||||||
static TLS_CONF: Lazy<Arc<rustls::ClientConfig>> = Lazy::new(|| {
|
static TLS_CONF: Lazy<Arc<rustls::ClientConfig>> = Lazy::new(|| {
|
||||||
let mut root_store = rustls::RootCertStore::empty();
|
let mut root_store = rustls::RootCertStore::empty();
|
||||||
#[cfg(not(feature = "native-tls"))]
|
#[cfg(not(feature = "native-certs"))]
|
||||||
root_store.add_server_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.0.iter().map(|ta| {
|
root_store.add_server_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.0.iter().map(|ta| {
|
||||||
rustls::OwnedTrustAnchor::from_subject_spki_name_constraints(
|
rustls::OwnedTrustAnchor::from_subject_spki_name_constraints(
|
||||||
ta.subject,
|
ta.subject,
|
||||||
@@ -343,10 +343,11 @@ pub(crate) fn connect_https(unit: &Unit, hostname: &str) -> Result<Stream, Error
|
|||||||
ta.name_constraints,
|
ta.name_constraints,
|
||||||
)
|
)
|
||||||
}));
|
}));
|
||||||
#[cfg(feature = "native-tls")]
|
#[cfg(feature = "native-certs")]
|
||||||
root_store.add_server_trust_anchors(
|
for cert in rustls_native_certs::load_native_certs().expect("Could not load platform certs")
|
||||||
rustls_native_certs::load_native_certs().expect("Could not load platform certs"),
|
{
|
||||||
);
|
root_store.add(&rustls::Certificate(cert.0)).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
let config = rustls::ClientConfig::builder()
|
let config = rustls::ClientConfig::builder()
|
||||||
.with_safe_defaults()
|
.with_safe_defaults()
|
||||||
|
|||||||
2
test.sh
2
test.sh
@@ -5,7 +5,7 @@ export RUST_BACKTRACE=1
|
|||||||
export RUSTFLAGS="-D dead_code -D unused-variables -D unused"
|
export RUSTFLAGS="-D dead_code -D unused-variables -D unused"
|
||||||
|
|
||||||
for tls in "" tls ; do
|
for tls in "" tls ; do
|
||||||
for feature in "" json charset cookies socks-proxy ; do
|
for feature in "" json charset cookies socks-proxy native-certs ; do
|
||||||
if ! cargo test --no-default-features --features "${tls} ${feature}" ; then
|
if ! cargo test --no-default-features --features "${tls} ${feature}" ; then
|
||||||
echo Command failed: cargo test \"${what}\" --no-default-features --features \"${tls} ${feature}\"
|
echo Command failed: cargo test \"${what}\" --no-default-features --features \"${tls} ${feature}\"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user