File tree 4 files changed +11
-9
lines changed
4 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ pin-project-lite = "0.2.13"
22
22
thiserror = " 1.0.30"
23
23
tokio = { version = " 1.0" , features = [" time" ] }
24
24
tokio-native-tls = { version = " 0.3.0" , optional = true }
25
- tokio-rustls = { version = " 0.24 .0" , optional = true }
25
+ tokio-rustls = { version = " 0.25 .0" , optional = true }
26
26
tokio-openssl = { version = " 0.6.3" , optional = true }
27
27
openssl_impl = { package = " openssl" , version = " 0.10.32" , optional = true }
28
28
Original file line number Diff line number Diff line change 1
1
#[ cfg( feature = "rustls" ) ]
2
2
mod config {
3
3
use std:: sync:: Arc ;
4
- use tokio_rustls:: rustls:: { Certificate , PrivateKey , ServerConfig } ;
4
+ use tokio_rustls:: rustls:: {
5
+ pki_types:: { CertificateDer , PrivateKeyDer } ,
6
+ ServerConfig ,
7
+ } ;
5
8
6
9
const CERT : & [ u8 ] = include_bytes ! ( "local.cert" ) ;
7
10
const PKEY : & [ u8 ] = include_bytes ! ( "local.key" ) ;
@@ -12,12 +15,11 @@ mod config {
12
15
13
16
pub type Acceptor = tokio_rustls:: TlsAcceptor ;
14
17
15
- fn tls_acceptor_impl ( cert_der : & [ u8 ] , key_der : & [ u8 ] ) -> Acceptor {
16
- let key = PrivateKey ( cert_der . into ( ) ) ;
17
- let cert = Certificate ( key_der . into ( ) ) ;
18
+ fn tls_acceptor_impl ( key_der : & [ u8 ] , cert_der : & [ u8 ] ) -> Acceptor {
19
+ let key = PrivateKeyDer :: Pkcs1 ( key_der . to_owned ( ) . into ( ) ) ;
20
+ let cert = CertificateDer :: from ( cert_der ) . into_owned ( ) ;
18
21
Arc :: new (
19
22
ServerConfig :: builder ( )
20
- . with_safe_defaults ( )
21
23
. with_no_client_auth ( )
22
24
. with_single_cert ( vec ! [ cert] , key)
23
25
. unwrap ( ) ,
Original file line number Diff line number Diff line change @@ -76,14 +76,14 @@ async fn tls_error() {
76
76
) ;
77
77
}
78
78
79
- static LONG_TEXT : & ' static [ u8 ] = include_bytes ! ( "long_text.txt" ) ;
79
+ static LONG_TEXT : & [ u8 ] = include_bytes ! ( "long_text.txt" ) ;
80
80
81
81
#[ tokio:: test]
82
82
async fn echo ( ) {
83
83
let ( ender, ended) = oneshot:: channel ( ) ;
84
84
let ( connector, listener) = setup_echo ( ended) ;
85
85
86
- async fn check_message ( c : & MockConnect , msg : & [ u8 ] ) -> ( ) {
86
+ async fn check_message ( c : & MockConnect , msg : & [ u8 ] ) {
87
87
let resp = c. send_data ( msg) . await ;
88
88
assert_ascii_eq ! ( resp. unwrap( ) , msg. to_ascii_lowercase( ) ) ;
89
89
}
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ impl AsyncWrite for MockTlsStream {
116
116
buf : & [ u8 ] ,
117
117
) -> Poll < io:: Result < usize > > {
118
118
let data = buf. to_ascii_lowercase ( ) ;
119
- self . inner ( ) . poll_write ( cx, & * data)
119
+ self . inner ( ) . poll_write ( cx, & data)
120
120
}
121
121
122
122
fn poll_flush ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < io:: Result < ( ) > > {
You can’t perform that action at this time.
0 commit comments