@@ -10,7 +10,7 @@ use std::fmt;
10
10
#[ derive( Clone , Default ) ]
11
11
pub struct ClientTlsConfig {
12
12
domain : Option < String > ,
13
- cert : Option < Certificate > ,
13
+ certs : Vec < Certificate > ,
14
14
identity : Option < Identity > ,
15
15
assume_http2 : bool ,
16
16
}
@@ -19,7 +19,7 @@ impl fmt::Debug for ClientTlsConfig {
19
19
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
20
20
f. debug_struct ( "ClientTlsConfig" )
21
21
. field ( "domain" , & self . domain )
22
- . field ( "cert " , & self . cert )
22
+ . field ( "certs " , & self . certs )
23
23
. field ( "identity" , & self . identity )
24
24
. finish ( )
25
25
}
@@ -30,7 +30,7 @@ impl ClientTlsConfig {
30
30
pub fn new ( ) -> Self {
31
31
ClientTlsConfig {
32
32
domain : None ,
33
- cert : None ,
33
+ certs : Vec :: new ( ) ,
34
34
identity : None ,
35
35
assume_http2 : false ,
36
36
}
@@ -46,10 +46,16 @@ impl ClientTlsConfig {
46
46
47
47
/// Sets the CA Certificate against which to verify the server's TLS certificate.
48
48
pub fn ca_certificate ( self , ca_certificate : Certificate ) -> Self {
49
- ClientTlsConfig {
50
- cert : Some ( ca_certificate) ,
51
- ..self
52
- }
49
+ let mut certs = self . certs ;
50
+ certs. push ( ca_certificate) ;
51
+ ClientTlsConfig { certs, ..self }
52
+ }
53
+
54
+ /// Sets the multiple CA Certificates against which to verify the server's TLS certificate.
55
+ pub fn ca_certificates ( self , ca_certificates : impl IntoIterator < Item = Certificate > ) -> Self {
56
+ let mut certs = self . certs ;
57
+ certs. extend ( ca_certificates) ;
58
+ ClientTlsConfig { certs, ..self }
53
59
}
54
60
55
61
/// Sets the client identity to present to the server.
@@ -75,7 +81,7 @@ impl ClientTlsConfig {
75
81
None => uri. host ( ) . ok_or_else ( Error :: new_invalid_uri) ?,
76
82
} ;
77
83
TlsConnector :: new (
78
- self . cert . clone ( ) ,
84
+ self . certs . clone ( ) ,
79
85
self . identity . clone ( ) ,
80
86
domain,
81
87
self . assume_http2 ,
0 commit comments