diff --git a/Cargo.lock b/Cargo.lock index 9a897db65..9031946fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -128,7 +128,7 @@ dependencies = [ "h2 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.11.15 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.11.19 (registry+https://github.com/rust-lang/crates.io-index)", "ipnet 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -360,7 +360,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "hyper" -version = "0.11.15" +version = "0.11.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "base64 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -369,6 +369,7 @@ dependencies = [ "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1230,7 +1231,7 @@ dependencies = [ "checksum heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea04fa3ead4e05e51a7c806fc07271fdbde4e246a6c6d1efd52e72230b771b82" "checksum http 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf8217d8829cc05dedadc08b4bc0684e5e3fbba1126c5edc680af49053fa230c" "checksum httparse 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2f407128745b78abc95c0ffbe4e5d37427fdc0d45470710cfef8c44522a2e37" -"checksum hyper 0.11.15 (registry+https://github.com/rust-lang/crates.io-index)" = "4d6105c5eeb03068b10ff34475a0d166964f98e7b9777cc34b342a225af9b87c" +"checksum hyper 0.11.19 (registry+https://github.com/rust-lang/crates.io-index)" = "47659bb1cb7ef3cd7b4f9bd2a11349b8d92097d34f9597a3c09e9bcefaf92b61" "checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum ipnet 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51268c3a27ad46afd1cca0bbf423a5be2e9fd3e6a7534736c195f0f834b763ef" diff --git a/proxy/Cargo.toml b/proxy/Cargo.toml index 0cc91ec04..9b10cc094 100644 --- a/proxy/Cargo.toml +++ b/proxy/Cargo.toml @@ -17,7 +17,7 @@ futures = "0.1" h2 = "0.1" http = "0.1" httparse = "1.2" -hyper = { version = "0.11.15", features = ["compat"] } +hyper = { version = "0.11.19", features = ["compat"] } ipnet = "1.0" log = "0.3" ordermap = "0.2" diff --git a/proxy/src/transparency/glue.rs b/proxy/src/transparency/glue.rs index 8834b9d87..2b9b3dc83 100644 --- a/proxy/src/transparency/glue.rs +++ b/proxy/src/transparency/glue.rs @@ -246,12 +246,6 @@ where hyper::Error::Io(io::ErrorKind::Other.into()) })); - if res.status() == http::StatusCode::SWITCHING_PROTOCOLS { - debug!("HTTP/1.1 101 upgrade not supported"); - let res = hyper::Response::new() - .with_status(hyper::StatusCode::BadGateway); - return Ok(Async::Ready(res)); - } h1::strip_connection_headers(res.headers_mut()); Ok(Async::Ready(res.map(BodyStream::new).into())) } diff --git a/proxy/tests/transparency.rs b/proxy/tests/transparency.rs index ee5272b4d..141cdf613 100644 --- a/proxy/tests/transparency.rs +++ b/proxy/tests/transparency.rs @@ -291,6 +291,25 @@ fn http11_upgrade_not_supported() { tcp_client.write(msg1); - let expected = "HTTP/1.1 502 Bad Gateway\r\n"; + let expected = "HTTP/1.1 500 "; assert_eq!(s(&tcp_client.read()[..expected.len()]), expected); } + +#[test] +fn http1_get_doesnt_add_transfer_encoding() { + let _ = env_logger::init(); + + let srv = server::http1() + .route_fn("/", |req| { + assert!(!req.headers().contains_key("transfer-encoding")); + Response::new("hello h1".into()) + }) + .run(); + let ctrl = controller::new().run(); + let proxy = proxy::new() + .controller(ctrl) + .inbound(srv) + .run(); + let client = client::http1(proxy.inbound, "transparency.test.svc.cluster.local"); + assert_eq!(client.get("/"), "hello h1"); +}