@@ -5,7 +5,7 @@ use std::task::{Context, Poll};
5
5
6
6
use hyper:: { client:: connect:: HttpConnector , service:: Service , Uri } ;
7
7
use tokio:: io:: { AsyncRead , AsyncWrite } ;
8
- use tokio_native_tls :: TlsConnector ;
8
+ use tokio_tls :: TlsConnector ;
9
9
10
10
use crate :: stream:: MaybeHttpsStream ;
11
11
@@ -65,18 +65,13 @@ impl<T> HttpsConnector<T> {
65
65
pub fn https_only ( & mut self , enable : bool ) {
66
66
self . force_https = enable;
67
67
}
68
-
68
+
69
69
/// With connector constructor
70
- ///
70
+ ///
71
71
pub fn new_with_connector ( http : T ) -> Self {
72
72
native_tls:: TlsConnector :: new ( )
73
73
. map ( |tls| HttpsConnector :: from ( ( http, tls. into ( ) ) ) )
74
- . unwrap_or_else ( |e| {
75
- panic ! (
76
- "HttpsConnector::new_with_connector(<connector>) failure: {}" ,
77
- e
78
- )
79
- } )
74
+ . unwrap_or_else ( |e| panic ! ( "HttpsConnector::new_with_connector(<connector>) failure: {}" , e) )
80
75
}
81
76
}
82
77
@@ -131,7 +126,9 @@ where
131
126
let fut = async move {
132
127
let tcp = connecting. await . map_err ( Into :: into) ?;
133
128
let maybe = if is_https {
134
- let tls = tls. connect ( & host, tcp) . await ?;
129
+ let tls = tls
130
+ . connect ( & host, tcp)
131
+ . await ?;
135
132
MaybeHttpsStream :: Https ( tls)
136
133
} else {
137
134
MaybeHttpsStream :: Http ( tcp)
@@ -146,7 +143,8 @@ fn err<T>(e: BoxError) -> HttpsConnecting<T> {
146
143
HttpsConnecting ( Box :: pin ( async { Err ( e) } ) )
147
144
}
148
145
149
- type BoxedFut < T > = Pin < Box < dyn Future < Output = Result < MaybeHttpsStream < T > , BoxError > > + Send > > ;
146
+ type BoxedFut < T > =
147
+ Pin < Box < dyn Future < Output = Result < MaybeHttpsStream < T > , BoxError > > + Send > > ;
150
148
151
149
/// A Future representing work to connect to a URL, and a TLS handshake.
152
150
pub struct HttpsConnecting < T > ( BoxedFut < T > ) ;
0 commit comments