Skip to content

Commit c4f166e

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

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
@@ -256,16 +256,19 @@ async fn download_file_(
256256
(Backend::Curl, Notification::UsingCurl)
257257
} else {
258258
let tls_backend = if use_rustls {
259-
TlsBackend::Rustls
260-
} else {
261-
#[cfg(feature = "reqwest-native-tls")]
259+
#[cfg(feature = "reqwest-rustls-tls")]
262260
{
263-
TlsBackend::NativeTls
261+
TlsBackend::Rustls
264262
}
265-
#[cfg(not(feature = "reqwest-native-tls"))]
263+
// If the `reqwest-rustls-tls` feature is disabled,
264+
// `use_rustls` will remain to be `true` by default;
265+
// we still have to fall back on `NativeTls` in this case.
266+
#[cfg(not(feature = "reqwest-rustls-tls"))]
266267
{
267-
TlsBackend::Rustls
268+
TlsBackend::NativeTls
268269
}
270+
} else {
271+
TlsBackend::NativeTls
269272
};
270273
(Backend::Reqwest(tls_backend), Notification::UsingReqwest)
271274
};

0 commit comments

Comments
 (0)