@@ -36,6 +36,7 @@ pub struct SslOpts {
3636 password : Option < Cow < ' static , str > > ,
3737 root_cert_path : Option < Cow < ' static , Path > > ,
3838 skip_domain_validation : bool ,
39+ accept_invalid_certs : bool ,
3940}
4041
4142impl SslOpts {
@@ -45,6 +46,7 @@ impl SslOpts {
4546 password : None ,
4647 root_cert_path : None ,
4748 skip_domain_validation : false ,
49+ accept_invalid_certs : false ,
4850 }
4951 }
5052
@@ -79,6 +81,13 @@ impl SslOpts {
7981 self
8082 }
8183
84+ /// If `true` then client will accept invalid certificate (expired, not trusted, ..)
85+ /// (defaults to `false`).
86+ pub fn set_danger_accept_invalid_certs ( & mut self , value : bool ) -> & mut Self {
87+ self . accept_invalid_certs = value;
88+ self
89+ }
90+
8291 pub fn pkcs12_path ( & self ) -> Option < & Path > {
8392 self . pkcs12_path . as_ref ( ) . map ( |x| x. as_ref ( ) )
8493 }
@@ -94,6 +103,10 @@ impl SslOpts {
94103 pub fn skip_domain_validation ( & self ) -> bool {
95104 self . skip_domain_validation
96105 }
106+
107+ pub fn accept_invalid_certs ( & self ) -> bool {
108+ self . accept_invalid_certs
109+ }
97110}
98111
99112/// Mysql connection options.
0 commit comments