|
1 | | -//! TLS configuration |
| 1 | +//! TLS configuration and types |
2 | 2 | //! |
3 | | -//! By default, a `Client` will make use of system-native transport layer |
4 | | -//! security to connect to HTTPS destinations. This means schannel on Windows, |
5 | | -//! Security-Framework on macOS, and OpenSSL on Linux. |
| 3 | +//! A `Client` will use transport layer security (TLS) by default to connect to |
| 4 | +//! HTTPS destinations. |
6 | 5 | //! |
7 | | -//! - Additional X509 certificates can be configured on a `ClientBuilder` with the |
8 | | -//! [`Certificate`] type. |
9 | | -//! - Client certificates can be added to a `ClientBuilder` with the |
10 | | -//! [`Identity`] type. |
11 | | -//! - Various parts of TLS can also be configured or even disabled on the |
12 | | -//! `ClientBuilder`. |
| 6 | +//! # Backends |
| 7 | +//! |
| 8 | +//! reqwest supports several TLS backends, enabled with Cargo features. |
| 9 | +//! |
| 10 | +//! ## default-tls |
| 11 | +//! |
| 12 | +//! reqwest will pick a TLS backend by default. This is true when the |
| 13 | +//! `default-tls` feature is enabled. |
| 14 | +//! |
| 15 | +//! While it currently uses `native-tls`, the feature set is designed to only |
| 16 | +//! enable configuration that is shared among available backends. This allows |
| 17 | +//! reqwest to change the default to `rustls` (or another) at some point in the |
| 18 | +//! future. |
| 19 | +//! |
| 20 | +//! <div class="warning">This feature is enabled by default, and takes |
| 21 | +//! precedence if any other crate enables it. This is true even if you declare |
| 22 | +//! `features = []`. You must set `no-default-features = false` instead.</div> |
| 23 | +//! |
| 24 | +//! Since Cargo features are additive, other crates in your dependency tree can |
| 25 | +//! cause the default backend to be enabled. If you wish to ensure your |
| 26 | +//! `Client` uses a specific backend, call the appropriate builder methods |
| 27 | +//! (such as [`use_rustls_tls()`][]). |
| 28 | +//! |
| 29 | +//! [`use_rustls_tls()`]: crate::ClientBuilder::use_rustls_tls() |
| 30 | +//! |
| 31 | +//! ## native-tls |
| 32 | +//! |
| 33 | +//! This backend uses the [native-tls][] crate. That will try to use the system |
| 34 | +//! TLS on Windows and Mac, and OpenSSL on Linux targets. |
| 35 | +//! |
| 36 | +//! Enabling the feature explicitly allows for `native-tls`-specific |
| 37 | +//! configuration options. |
| 38 | +//! |
| 39 | +//! [native-tls]: https://crates.io/crates/native-tls |
| 40 | +//! |
| 41 | +//! ## rustls-tls |
| 42 | +//! |
| 43 | +//! This backend uses the [rustls][] crate, a TLS library written in Rust. |
| 44 | +//! |
| 45 | +//! [rustls]: https://crates.io/crates/rustls |
13 | 46 |
|
14 | 47 | #[cfg(feature = "__rustls")] |
15 | 48 | use rustls::{ |
|
0 commit comments