fix(client): return Version errors if unsupported
If a `Request`'s version is `Http09`, `H2`, or `H2c`, `client.request` will return a `hyper::Error::Version`, and a message is logged at `error!` level. Closes #1283
This commit is contained in:
		| @@ -24,6 +24,7 @@ use http::request; | ||||
| use method::Method; | ||||
| use self::pool::{Pool, Pooled}; | ||||
| use uri::{self, Uri}; | ||||
| use version::HttpVersion; | ||||
|  | ||||
| pub use http::response::Response; | ||||
| pub use http::request::Request; | ||||
| @@ -139,6 +140,15 @@ where C: Connect, | ||||
|     type Future = FutureResponse; | ||||
|  | ||||
|     fn call(&self, req: Self::Request) -> Self::Future { | ||||
|         match req.version() { | ||||
|             HttpVersion::Http10 | | ||||
|             HttpVersion::Http11 => (), | ||||
|             other => { | ||||
|                 error!("Request has unsupported version \"{}\"", other); | ||||
|                 return FutureResponse(Box::new(future::err(::Error::Version))); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         let url = req.uri().clone(); | ||||
|         let domain = match uri::scheme_and_authority(&url) { | ||||
|             Some(uri) => uri, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user