File tree Expand file tree Collapse file tree 2 files changed +21
-8
lines changed Expand file tree Collapse file tree 2 files changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ rust-version = "1.76"
16
16
17
17
[features ]
18
18
default = []
19
- tls = [" rustls" , " rustls-pemfile" , " webpki-roots" , " futures-rustls" ]
19
+ tls = [" rustls" , " rustls-pemfile" , " futures-rustls" ]
20
+ tls-mozilla-roots = [" tls" , " webpki-roots" ]
20
21
sasl = [" sasl-gssapi" , " sasl-digest-md5" ]
21
22
sasl-digest-md5 = [" rsasl/unstable_custom_mechanism" , " md5" , " linkme" , " hex" ]
22
23
sasl-gssapi = [" rsasl/gssapi" ]
@@ -39,7 +40,7 @@ either = "1.9.0"
39
40
uuid = { version = " 1.4.1" , features = [" v4" ] }
40
41
rustls = { version = " 0.23.2" , optional = true }
41
42
rustls-pemfile = { version = " 2" , optional = true }
42
- webpki-roots = { version = " 0.26 .1" , optional = true }
43
+ webpki-roots = { version = " 1.0 .1" , optional = true }
43
44
derive-where = " 1.2.7"
44
45
fastrand = " 2.0.2"
45
46
tracing = " 0.1.40"
Original file line number Diff line number Diff line change @@ -28,11 +28,9 @@ impl Clone for TlsOptions {
28
28
}
29
29
30
30
impl Default for TlsOptions {
31
- /// Tls options with well-known ca roots .
31
+ /// Same as [Self::new] .
32
32
fn default ( ) -> Self {
33
- let mut options = Self :: no_ca ( ) ;
34
- options. ca_certs . extend ( webpki_roots:: TLS_SERVER_ROOTS . iter ( ) . cloned ( ) ) ;
35
- options
33
+ Self :: new ( )
36
34
}
37
35
}
38
36
@@ -106,12 +104,26 @@ impl ServerCertVerifier for TlsServerCertVerifier {
106
104
}
107
105
108
106
impl TlsOptions {
109
- /// Tls options with no ca certificates. Use [TlsOptions::default] if well-known ca roots is
110
- /// desirable.
107
+ /// Tls options with no ca certificates.
108
+ # [ deprecated ( since = "0.10.0" , note = "use TlsOptions::new instead" ) ]
111
109
pub fn no_ca ( ) -> Self {
110
+ Self :: new ( )
111
+ }
112
+
113
+ /// Tls options with no ca certificates.
114
+ pub fn new ( ) -> Self {
112
115
Self { ca_certs : RootCertStore :: empty ( ) , identity : None , hostname_verification : true }
113
116
}
114
117
118
+ /// Trusts root certificates trusted by Mozilla.
119
+ ///
120
+ /// See [webpki-roots](https://docs.rs/webpki-roots) for more.
121
+ #[ cfg( feature = "tls-mozilla-roots" ) ]
122
+ pub fn with_mozilla_roots ( mut self ) -> Self {
123
+ self . ca_certs . extend ( webpki_roots:: TLS_SERVER_ROOTS . iter ( ) . cloned ( ) ) ;
124
+ self
125
+ }
126
+
115
127
/// Disables hostname verification in tls handshake.
116
128
///
117
129
/// # Safety
You can’t perform that action at this time.
0 commit comments