refactor(hyper): Update to rust-url 1.0

BREAKING CHANGE: The re-exported Url type has breaking changes.
This commit is contained in:
Simon Sapin
2016-04-22 01:14:08 +02:00
committed by Sean McArthur
parent 4bdf52a482
commit 8fa7a98968
9 changed files with 54 additions and 54 deletions

View File

@@ -7,6 +7,7 @@ use std::net::Shutdown;
use std::time::Duration;
use httparse;
use url::Position as UrlPosition;
use buffer::BufReader;
use Error;
@@ -142,24 +143,22 @@ impl HttpMessage for Http11Message {
};
let mut stream = BufWriter::new(stream);
let mut uri = head.url.serialize_path().unwrap();
if let Some(ref q) = head.url.query {
uri.push('?');
uri.push_str(&q[..]);
}
{
let uri = &head.url[UrlPosition::BeforePath..UrlPosition::AfterQuery];
let version = version::HttpVersion::Http11;
debug!("request line: {:?} {:?} {:?}", head.method, uri, version);
match write!(&mut stream, "{} {} {}{}",
head.method, uri, version, LINE_ENDING) {
Err(e) => {
res = Err(From::from(e));
// TODO What should we do if the BufWriter doesn't wanna
// relinquish the stream?
return Stream::Idle(stream.into_inner().ok().unwrap());
},
Ok(_) => {},
};
let version = version::HttpVersion::Http11;
debug!("request line: {:?} {:?} {:?}", head.method, uri, version);
match write!(&mut stream, "{} {} {}{}",
head.method, uri, version, LINE_ENDING) {
Err(e) => {
res = Err(From::from(e));
// TODO What should we do if the BufWriter doesn't wanna
// relinquish the stream?
return Stream::Idle(stream.into_inner().ok().unwrap());
},
Ok(_) => {},
};
}
let stream = {
let write_headers = |mut stream: BufWriter<Box<NetworkStream + Send>>, head: &RequestHead| {