@@ -30,7 +30,7 @@ use openssl::ssl::VerifyCallback;
30
30
use header:: { Headers , Header , HeaderFormat } ;
31
31
use header:: common:: { ContentLength , Location } ;
32
32
use method:: Method ;
33
- use net:: { NetworkConnector , NetworkStream , HttpConnector } ;
33
+ use net:: { NetworkConnector , HttpConnector } ;
34
34
use status:: StatusClass :: Redirection ;
35
35
use { Url , Port , HttpResult } ;
36
36
use HttpError :: HttpUriError ;
@@ -63,8 +63,7 @@ impl Client<HttpConnector> {
63
63
64
64
}
65
65
66
- #[ old_impl_check]
67
- impl < C : NetworkConnector < S > , S : NetworkStream > Client < C > {
66
+ impl < C : NetworkConnector > Client < C > {
68
67
69
68
/// Create a new client with a specific connector.
70
69
pub fn with_connector ( connector : C ) -> Client < C > {
@@ -80,33 +79,33 @@ impl<C: NetworkConnector<S>, S: NetworkStream> Client<C> {
80
79
}
81
80
82
81
/// Execute a Get request.
83
- pub fn get < U : IntoUrl > ( & mut self , url : U ) -> RequestBuilder < U , C , S > {
82
+ pub fn get < U : IntoUrl > ( & mut self , url : U ) -> RequestBuilder < U , C > {
84
83
self . request ( Method :: Get , url)
85
84
}
86
85
87
86
/// Execute a Head request.
88
- pub fn head < U : IntoUrl > ( & mut self , url : U ) -> RequestBuilder < U , C , S > {
87
+ pub fn head < U : IntoUrl > ( & mut self , url : U ) -> RequestBuilder < U , C > {
89
88
self . request ( Method :: Head , url)
90
89
}
91
90
92
91
/// Execute a Post request.
93
- pub fn post < U : IntoUrl > ( & mut self , url : U ) -> RequestBuilder < U , C , S > {
92
+ pub fn post < U : IntoUrl > ( & mut self , url : U ) -> RequestBuilder < U , C > {
94
93
self . request ( Method :: Post , url)
95
94
}
96
95
97
96
/// Execute a Put request.
98
- pub fn put < U : IntoUrl > ( & mut self , url : U ) -> RequestBuilder < U , C , S > {
97
+ pub fn put < U : IntoUrl > ( & mut self , url : U ) -> RequestBuilder < U , C > {
99
98
self . request ( Method :: Put , url)
100
99
}
101
100
102
101
/// Execute a Delete request.
103
- pub fn delete < U : IntoUrl > ( & mut self , url : U ) -> RequestBuilder < U , C , S > {
102
+ pub fn delete < U : IntoUrl > ( & mut self , url : U ) -> RequestBuilder < U , C > {
104
103
self . request ( Method :: Delete , url)
105
104
}
106
105
107
106
108
107
/// Build a new request using this Client.
109
- pub fn request < U : IntoUrl > ( & mut self , method : Method , url : U ) -> RequestBuilder < U , C , S > {
108
+ pub fn request < U : IntoUrl > ( & mut self , method : Method , url : U ) -> RequestBuilder < U , C > {
110
109
RequestBuilder {
111
110
client : self ,
112
111
method : method,
@@ -121,30 +120,30 @@ impl<C: NetworkConnector<S>, S: NetworkStream> Client<C> {
121
120
///
122
121
/// One of these will be built for you if you use one of the convenience
123
122
/// methods, such as `get()`, `post()`, etc.
124
- pub struct RequestBuilder < ' a , U : IntoUrl , C : NetworkConnector < S > + ' a , S : NetworkStream > {
123
+ pub struct RequestBuilder < ' a , U : IntoUrl , C : NetworkConnector + ' a > {
125
124
client : & ' a mut Client < C > ,
126
125
url : U ,
127
126
headers : Option < Headers > ,
128
127
method : Method ,
129
128
body : Option < Body < ' a > > ,
130
129
}
131
130
132
- impl < ' a , U : IntoUrl , C : NetworkConnector < S > , S : NetworkStream > RequestBuilder < ' a , U , C , S > {
131
+ impl < ' a , U : IntoUrl , C : NetworkConnector > RequestBuilder < ' a , U , C > {
133
132
134
133
/// Set a request body to be sent.
135
- pub fn body < B : IntoBody < ' a > > ( mut self , body : B ) -> RequestBuilder < ' a , U , C , S > {
134
+ pub fn body < B : IntoBody < ' a > > ( mut self , body : B ) -> RequestBuilder < ' a , U , C > {
136
135
self . body = Some ( body. into_body ( ) ) ;
137
136
self
138
137
}
139
138
140
139
/// Add additional headers to the request.
141
- pub fn headers ( mut self , headers : Headers ) -> RequestBuilder < ' a , U , C , S > {
140
+ pub fn headers ( mut self , headers : Headers ) -> RequestBuilder < ' a , U , C > {
142
141
self . headers = Some ( headers) ;
143
142
self
144
143
}
145
144
146
145
/// Add an individual new header to the request.
147
- pub fn header < H : Header + HeaderFormat > ( mut self , header : H ) -> RequestBuilder < ' a , U , C , S > {
146
+ pub fn header < H : Header + HeaderFormat > ( mut self , header : H ) -> RequestBuilder < ' a , U , C > {
148
147
{
149
148
let mut headers = match self . headers {
150
149
Some ( ref mut h) => h,
@@ -243,15 +242,16 @@ pub enum Body<'a> {
243
242
/// A Reader does not necessarily know it's size, so it is chunked.
244
243
ChunkedBody ( & ' a mut ( Reader + ' a ) ) ,
245
244
/// For Readers that can know their size, like a `File`.
246
- SizedBody ( & ' a mut ( Reader + ' a ) , usize ) ,
245
+ SizedBody ( & ' a mut ( Reader + ' a ) , u64 ) ,
247
246
/// A String has a size, and uses Content-Length.
248
247
BufBody ( & ' a [ u8 ] , usize ) ,
249
248
}
250
249
251
250
impl < ' a > Body < ' a > {
252
- fn size ( & self ) -> Option < usize > {
251
+ fn size ( & self ) -> Option < u64 > {
253
252
match * self {
254
- Body :: SizedBody ( _, len) | Body :: BufBody ( _, len) => Some ( len) ,
253
+ Body :: SizedBody ( _, len) => Some ( len) ,
254
+ Body :: BufBody ( _, len) => Some ( len as u64 ) ,
255
255
_ => None
256
256
}
257
257
}
0 commit comments