@@ -11,33 +11,23 @@ use std::{
11
11
use futures:: { ready, Stream } ;
12
12
use hyper:: {
13
13
body:: { Bytes , HttpBody } ,
14
- client:: {
15
- connect:: { Connect , Connection } ,
16
- ResponseFuture ,
17
- } ,
14
+ client:: { connect:: Connect , ResponseFuture } ,
18
15
header:: { HeaderMap , HeaderName , HeaderValue } ,
19
- service:: Service ,
20
16
Body , Request , StatusCode , Uri ,
21
17
} ;
22
18
#[ cfg( feature = "rustls" ) ]
23
19
use hyper_rustls:: HttpsConnector as RustlsConnector ;
24
20
use log:: { debug, info, trace, warn} ;
25
21
use pin_project:: pin_project;
26
-
27
- use tokio:: {
28
- io:: { AsyncRead , AsyncWrite } ,
29
- time:: Sleep ,
30
- } ;
22
+ use tokio:: time:: Sleep ;
31
23
32
24
use super :: config:: ReconnectOptions ;
33
25
use super :: decode:: Decoded ;
34
26
use super :: error:: { Error , Result } ;
35
27
36
28
pub use hyper:: client:: HttpConnector ;
37
-
38
29
#[ cfg( feature = "rustls" ) ]
39
30
pub type HttpsConnector = RustlsConnector < HttpConnector > ;
40
- pub use hyper_timeout:: TimeoutConnector ;
41
31
42
32
/*
43
33
* TODO remove debug output
@@ -48,7 +38,6 @@ pub struct ClientBuilder {
48
38
url : Uri ,
49
39
headers : HeaderMap ,
50
40
reconnect_opts : ReconnectOptions ,
51
- read_timeout : Option < Duration > ,
52
41
}
53
42
54
43
impl ClientBuilder {
@@ -64,12 +53,6 @@ impl ClientBuilder {
64
53
Ok ( self )
65
54
}
66
55
67
- /// Set a read timeout for the underlying connection. There is no read timeout by default.
68
- pub fn read_timeout ( mut self , read_timeout : Duration ) -> ClientBuilder {
69
- self . read_timeout = Some ( read_timeout) ;
70
- self
71
- }
72
-
73
56
/// Configure the client's reconnect behaviour according to the supplied
74
57
/// [`ReconnectOptions`].
75
58
///
@@ -79,19 +62,12 @@ impl ClientBuilder {
79
62
self
80
63
}
81
64
82
- pub fn build_with_conn < C > ( self , conn : C ) -> Client < TimeoutConnector < C > >
65
+ pub fn build_with_conn < C > ( self , conn : C ) -> Client < C >
83
66
where
84
- C : Service < Uri > + Send + ' static + std:: clone:: Clone ,
85
- C :: Error : Into < Box < dyn std:: error:: Error + Send + Sync > > ,
86
- C :: Future : Unpin + Send ,
87
- C :: Response : AsyncRead + AsyncWrite + Connection + Unpin + Send ,
67
+ C : Connect + Clone ,
88
68
{
89
- let mut connector = TimeoutConnector :: new ( conn) ;
90
- connector. set_read_timeout ( self . read_timeout ) ;
91
- let client = hyper:: Client :: builder ( ) . build :: < _ , hyper:: Body > ( connector) ;
92
-
93
69
Client {
94
- http : client ,
70
+ http : hyper :: Client :: builder ( ) . build ( conn ) ,
95
71
request_props : RequestProps {
96
72
url : self . url ,
97
73
headers : self . headers ,
@@ -100,12 +76,12 @@ impl ClientBuilder {
100
76
}
101
77
}
102
78
103
- pub fn build_http ( self ) -> Client < TimeoutConnector < HttpConnector > > {
79
+ pub fn build_http ( self ) -> Client < HttpConnector > {
104
80
self . build_with_conn ( HttpConnector :: new ( ) )
105
81
}
106
82
107
83
#[ cfg( feature = "rustls" ) ]
108
- pub fn build ( self ) -> Client < TimeoutConnector < HttpsConnector > > {
84
+ pub fn build ( self ) -> Client < HttpsConnector > {
109
85
let conn = HttpsConnector :: with_native_roots ( ) ;
110
86
self . build_with_conn ( conn)
111
87
}
@@ -150,7 +126,6 @@ impl Client<()> {
150
126
url,
151
127
headers : HeaderMap :: new ( ) ,
152
128
reconnect_opts : ReconnectOptions :: default ( ) ,
153
- read_timeout : None ,
154
129
} )
155
130
}
156
131
}
0 commit comments