diff --git a/CHANGES.md b/CHANGES.md index 6c3de1048..f115cc03f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Changes +## 0.4.7 (2018-03-xx) + +* Fix panic on unknown content encoding + ## 0.4.6 (2018-03-10) * Fix client cookie handling diff --git a/src/handler.rs b/src/handler.rs index 035d02fa5..fd689699e 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -52,7 +52,7 @@ pub trait Responder { /// Either::A( /// httpcodes::HttpBadRequest.with_body("Bad data")) /// } else { -/// Either::B( // <- variant B +/// Either::B( // <- variant B /// result(HttpResponse::Ok() /// .content_type("text/html") /// .body(format!("Hello!")) diff --git a/src/header/mod.rs b/src/header/mod.rs index 7c3ad7eb1..d02ca9778 100644 --- a/src/header/mod.rs +++ b/src/header/mod.rs @@ -165,8 +165,7 @@ impl<'a> From<&'a str> for ContentEncoding { "br" => ContentEncoding::Br, "gzip" => ContentEncoding::Gzip, "deflate" => ContentEncoding::Deflate, - "identity" => ContentEncoding::Identity, - _ => ContentEncoding::Auto, + _ => ContentEncoding::Identity, } } } diff --git a/src/server/encoding.rs b/src/server/encoding.rs index df901818d..a7eaf1c00 100644 --- a/src/server/encoding.rs +++ b/src/server/encoding.rs @@ -466,8 +466,8 @@ impl ContentEncoder { GzEncoder::new(transfer, Compression::default())), ContentEncoding::Br => ContentEncoder::Br( BrotliEncoder::new(transfer, 5)), - ContentEncoding::Identity => ContentEncoder::Identity(transfer), - ContentEncoding::Auto => unreachable!() + ContentEncoding::Identity | ContentEncoding::Auto => + ContentEncoder::Identity(transfer), } }