This repository was archived by the owner on Nov 9, 2017. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ that's due to a Rust bug; when that's resolved, we'll go back to using just `Req
40
40
*/
41
41
42
42
use extra:: url:: Url ;
43
+ use extra:: url;
43
44
use method:: Method ;
44
45
use std:: rt:: io:: { Reader , Writer } ;
45
46
use std:: rt:: io:: net:: get_host_addresses;
@@ -203,8 +204,11 @@ impl RequestWriter<TcpStream> {
203
204
// TODO: get to the point where we can say HTTP/1.1 with good conscience
204
205
// XXX: Rust's current lack of statement-duration lifetime handling prevents this from being
205
206
// one statement ("error: borrowed value does not live long enough")
206
- // TODO: don't send the entire URL; just url.{path, query}
207
- let s = format ! ( "{} {} HTTP/1.0\r \n " , self . method. to_str( ) , self . url. to_str( ) ) ;
207
+ let s = format ! ( "{} {}{}{} HTTP/1.0\r \n " ,
208
+ self . method. to_str( ) ,
209
+ if self . url. path. len( ) > 0 { self . url. path. as_slice( ) } else { "/" } ,
210
+ if self . url. query. len( ) > 0 { "?" } else { "" } ,
211
+ url:: query_to_str( & self . url. query) ) ;
208
212
self . stream . write ( s. as_bytes ( ) ) ;
209
213
210
214
self . headers . write_all ( & mut self . stream ) ;
You can’t perform that action at this time.
0 commit comments