Module reqwest::tls

source ·
Expand description

TLS configuration and types

A Client will use transport layer security (TLS) by default to connect to HTTPS destinations.

§Backends

reqwest supports several TLS backends, enabled with Cargo features.

§default-tls

reqwest will pick a TLS backend by default. This is true when the default-tls feature is enabled.

While it currently uses native-tls, the feature set is designed to only enable configuration that is shared among available backends. This allows reqwest to change the default to rustls (or another) at some point in the future.

This feature is enabled by default, and takes precedence if any other crate enables it. This is true even if you declare `features = []`. You must set `no-default-features = false` instead.

Since Cargo features are additive, other crates in your dependency tree can cause the default backend to be enabled. If you wish to ensure your Client uses a specific backend, call the appropriate builder methods (such as use_rustls_tls()).

§native-tls

This backend uses the native-tls crate. That will try to use the system TLS on Windows and Mac, and OpenSSL on Linux targets.

Enabling the feature explicitly allows for native-tls-specific configuration options.

§rustls-tls

This backend uses the rustls crate, a TLS library written in Rust.

Structs§

  • Represents a server X509 certificate.
  • Represents a private key and X509 cert as a client certificate.
  • Hyper extension carrying extra TLS layer information. Made available to clients on responses when tls_info is set.
  • A TLS protocol version.