Add rustls-tls-manual-roots feature to allow callers to specify roots
Now, callers have more control over the set of roots. Note that, due to cargo unification, other dependencies in the dependency tree might enable rustls-tls-webpki-roots or rustls-tls. This will affect connections initiated by code that explicitly enabled rustls-tls-manual-roots. So for now, the choice is done once per entire cargo dependency graph. If people want more precise control over things, they can add methods that allow controlling this on a per-connection level. Even if such methods are available, the *-manual-roots feature will still be helpful with eliminating the webpki-roots dependency for those cargo graphs where there is no unification.
This commit is contained in:
		| @@ -1,6 +1,6 @@ | ||||
| #[cfg(any( | ||||
|     feature = "native-tls", | ||||
|     feature = "rustls-tls", | ||||
|     feature = "__rustls", | ||||
| ))] | ||||
| use std::any::Any; | ||||
| use std::convert::TryInto; | ||||
| @@ -414,7 +414,7 @@ impl ClientBuilder { | ||||
|     /// | ||||
|     /// # Optional | ||||
|     /// | ||||
|     /// This requires the optional `default-tls`, `native-tls`, or `rustls-tls` | ||||
|     /// This requires the optional `default-tls`, `native-tls`, or `rustls-tls(-...)` | ||||
|     /// feature to be enabled. | ||||
|     #[cfg(feature = "__tls")] | ||||
|     pub fn add_root_certificate(self, cert: Certificate) -> ClientBuilder { | ||||
| @@ -482,8 +482,8 @@ impl ClientBuilder { | ||||
|     /// | ||||
|     /// # Optional | ||||
|     /// | ||||
|     /// This requires the optional `rustls-tls` feature to be enabled. | ||||
|     #[cfg(feature = "rustls-tls")] | ||||
|     /// This requires the optional `rustls-tls(-...)` feature to be enabled. | ||||
|     #[cfg(feature = "__rustls")] | ||||
|     pub fn use_rustls_tls(self) -> ClientBuilder { | ||||
|         self.with_inner(move |inner| inner.use_rustls_tls()) | ||||
|     } | ||||
| @@ -505,10 +505,10 @@ impl ClientBuilder { | ||||
|     /// # Optional | ||||
|     /// | ||||
|     /// This requires one of the optional features `native-tls` or | ||||
|     /// `rustls-tls` to be enabled. | ||||
|     /// `rustls-tls(-...)` to be enabled. | ||||
|     #[cfg(any( | ||||
|         feature = "native-tls", | ||||
|         feature = "rustls-tls", | ||||
|         feature = "__rustls", | ||||
|     ))] | ||||
|     pub fn use_preconfigured_tls(self, tls: impl Any) -> ClientBuilder { | ||||
|         self.with_inner(move |inner| inner.use_preconfigured_tls(tls)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user