@@ -30,7 +30,7 @@ use openssl::ssl::VerifyCallback;
3030use header:: { Headers , Header , HeaderFormat } ;
3131use header:: common:: { ContentLength , Location } ;
3232use method:: Method ;
33- use net:: { NetworkConnector , NetworkStream , HttpConnector } ;
33+ use net:: { NetworkConnector , HttpConnector } ;
3434use status:: StatusClass :: Redirection ;
3535use { Url , Port , HttpResult } ;
3636use HttpError :: HttpUriError ;
@@ -63,8 +63,7 @@ impl Client<HttpConnector> {
6363
6464}
6565
66- #[ old_impl_check]
67- impl < C : NetworkConnector < S > , S : NetworkStream > Client < C > {
66+ impl < C : NetworkConnector > Client < C > {
6867
6968 /// Create a new client with a specific connector.
7069 pub fn with_connector ( connector : C ) -> Client < C > {
@@ -80,33 +79,33 @@ impl<C: NetworkConnector<S>, S: NetworkStream> Client<C> {
8079 }
8180
8281 /// 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 > {
8483 self . request ( Method :: Get , url)
8584 }
8685
8786 /// 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 > {
8988 self . request ( Method :: Head , url)
9089 }
9190
9291 /// 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 > {
9493 self . request ( Method :: Post , url)
9594 }
9695
9796 /// 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 > {
9998 self . request ( Method :: Put , url)
10099 }
101100
102101 /// 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 > {
104103 self . request ( Method :: Delete , url)
105104 }
106105
107106
108107 /// 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 > {
110109 RequestBuilder {
111110 client : self ,
112111 method : method,
@@ -121,30 +120,30 @@ impl<C: NetworkConnector<S>, S: NetworkStream> Client<C> {
121120///
122121/// One of these will be built for you if you use one of the convenience
123122/// 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 > {
125124 client : & ' a mut Client < C > ,
126125 url : U ,
127126 headers : Option < Headers > ,
128127 method : Method ,
129128 body : Option < Body < ' a > > ,
130129}
131130
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 > {
133132
134133 /// 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 > {
136135 self . body = Some ( body. into_body ( ) ) ;
137136 self
138137 }
139138
140139 /// 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 > {
142141 self . headers = Some ( headers) ;
143142 self
144143 }
145144
146145 /// 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 > {
148147 {
149148 let mut headers = match self . headers {
150149 Some ( ref mut h) => h,
@@ -243,15 +242,16 @@ pub enum Body<'a> {
243242 /// A Reader does not necessarily know it's size, so it is chunked.
244243 ChunkedBody ( & ' a mut ( Reader + ' a ) ) ,
245244 /// For Readers that can know their size, like a `File`.
246- SizedBody ( & ' a mut ( Reader + ' a ) , usize ) ,
245+ SizedBody ( & ' a mut ( Reader + ' a ) , u64 ) ,
247246 /// A String has a size, and uses Content-Length.
248247 BufBody ( & ' a [ u8 ] , usize ) ,
249248}
250249
251250impl < ' a > Body < ' a > {
252- fn size ( & self ) -> Option < usize > {
251+ fn size ( & self ) -> Option < u64 > {
253252 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 ) ,
255255 _ => None
256256 }
257257 }
0 commit comments