Skip to content

Commit 6aed5cd

Browse files
rami3lheiher
andcommitted
fix(download): default to NativeTls when reqwest-rustls-tls is disabled
Co-authored-by: WANG Rui <[email protected]>
1 parent eebc6a8 commit 6aed5cd

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/utils/mod.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,16 +255,19 @@ async fn download_file_(
255255
(Backend::Curl, Notification::UsingCurl)
256256
} else {
257257
let tls_backend = if use_rustls {
258-
TlsBackend::Rustls
259-
} else {
260-
#[cfg(feature = "reqwest-native-tls")]
258+
#[cfg(feature = "reqwest-rustls-tls")]
261259
{
262-
TlsBackend::NativeTls
260+
TlsBackend::Rustls
263261
}
264-
#[cfg(not(feature = "reqwest-native-tls"))]
262+
// If the `reqwest-rustls-tls` feature is disabled,
263+
// `use_rustls` will remain to be `true` by default;
264+
// we still have to fall back on `NativeTls` in this case.
265+
#[cfg(not(feature = "reqwest-rustls-tls"))]
265266
{
266-
TlsBackend::Rustls
267+
TlsBackend::NativeTls
267268
}
269+
} else {
270+
TlsBackend::NativeTls
268271
};
269272
(Backend::Reqwest(tls_backend), Notification::UsingReqwest)
270273
};

0 commit comments

Comments
 (0)