From d0491a4950f657c55dfbf6a16a16a64c72b9077c Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Fri, 26 Jun 2015 15:49:30 +0200 Subject: [PATCH] fix(hyper-up): work with hyper v0.6.0 Currently the latter actually fails to link on OSX, and requires a local override with [this fix](https://goo.gl/OTExmN). --- src/mako/Cargo.toml.mako | 4 ++-- src/mako/cli/lib/engine.mako | 2 +- src/rust/api/cmn.rs | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/mako/Cargo.toml.mako b/src/mako/Cargo.toml.mako index 82203c3d5b4..8442b730cc8 100644 --- a/src/mako/Cargo.toml.mako +++ b/src/mako/Cargo.toml.mako @@ -26,9 +26,9 @@ name = "${util.program_name()}" % endif [dependencies] -hyper = ">= 0.5.2" +hyper = ">= 0.6.0" ## Must match the one hyper uses, otherwise there are duplicate similarly named `Mime` structs -mime = "0.0.11" +mime = "0.0.12" serde = ">= 0.4.1" yup-oauth2 = "*" % for dep in cargo.get('dependencies', list()): diff --git a/src/mako/cli/lib/engine.mako b/src/mako/cli/lib/engine.mako index 4e7b516ca37..0f05336e79f 100644 --- a/src/mako/cli/lib/engine.mako +++ b/src/mako/cli/lib/engine.mako @@ -157,7 +157,7 @@ impl<'n, 'a> Engine<'n, 'a> { <%def name="_debug_client(flag_name)" buffered="True">\ if opt.is_present("${flag_name}") { hyper::Client::with_connector(mock::TeeConnector { - connector: hyper::net::HttpConnector(None) + connector: hyper::net::HttpsConnector::::default() }) } else { hyper::Client::new() diff --git a/src/rust/api/cmn.rs b/src/rust/api/cmn.rs index 1422e1f5544..d4a10abdfba 100644 --- a/src/rust/api/cmn.rs +++ b/src/rust/api/cmn.rs @@ -10,7 +10,7 @@ use oauth2::{TokenType, Retry, self}; use hyper; use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, HeaderFormat}; -use hyper::http::LINE_ENDING; +use hyper::http::h1::LINE_ENDING; use hyper::method::Method; use hyper::status::StatusCode; @@ -502,7 +502,7 @@ impl ::std::ops::DerefMut for XUploadContentType { } impl Header for XUploadContentType { fn header_name() -> &'static str { "X-Upload-Content-Type" } - fn parse_header(raw: &[Vec]) -> Option { + fn parse_header(raw: &[Vec]) -> hyper::error::Result { hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) } } @@ -567,8 +567,8 @@ impl Header for ContentRange { } /// We are not parsable, as parsing is done by the `Range` header - fn parse_header(_: &[Vec]) -> Option { - None + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) } } @@ -593,19 +593,19 @@ impl Header for RangeResponseHeader { "Range" } - fn parse_header(raw: &[Vec]) -> Option { + fn parse_header(raw: &[Vec]) -> hyper::error::Result { if raw.len() > 0 { let v = &raw[0]; if let Ok(s) = std::str::from_utf8(v) { const PREFIX: &'static str = "bytes "; if s.starts_with(PREFIX) { if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { - return Some(RangeResponseHeader(c)) + return Ok(RangeResponseHeader(c)) } } } } - None + Err(hyper::error::Error::Method) } }