File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
diesel/src/mysql/connection Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,13 @@ impl RawConnection {
4747 let port = connection_options. port ( ) ;
4848 let unix_socket = connection_options. unix_socket ( ) ;
4949
50+ if connection_options. ssl_mode ( ) . is_some ( ) {
51+ let ssl_mode = connection_options
52+ . ssl_mode ( )
53+ . expect ( "Failure on unwrapping ssl_mode" ) ;
54+ self . set_ssl_mode ( ssl_mode)
55+ }
56+
5057 unsafe {
5158 // Make sure you don't use the fake one!
5259 ffi:: mysql_real_connect (
@@ -179,6 +186,19 @@ impl RawConnection {
179186 unsafe { ffi:: mysql_next_result ( self . 0 . as_ptr ( ) ) } ;
180187 self . did_an_error_occur ( )
181188 }
189+
190+ fn set_ssl_mode ( & self , ssl_mode : mysqlclient_sys:: mysql_ssl_mode ) {
191+ let v = ssl_mode as u32 ;
192+ let v_ptr: * const u32 = & v;
193+ let n = ptr:: NonNull :: new ( v_ptr as * mut u32 ) . expect ( "NonNull::new failed" ) ;
194+ unsafe {
195+ mysqlclient_sys:: mysql_options (
196+ self . 0 . as_ptr ( ) ,
197+ mysqlclient_sys:: mysql_option:: MYSQL_OPT_SSL_MODE ,
198+ n. as_ptr ( ) as * const std:: ffi:: c_void ,
199+ )
200+ } ;
201+ }
182202}
183203
184204impl Drop for RawConnection {
You can’t perform that action at this time.
0 commit comments