1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-11-23 01:51:11 +00:00

Fix panic on unknown content encoding

This commit is contained in:
Nikolay Kim 2018-03-11 14:50:13 -07:00
parent fee1e255ac
commit 31fbbd3168
4 changed files with 8 additions and 5 deletions

View file

@ -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

View file

@ -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!"))

View file

@ -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,
}
}
}

View file

@ -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),
}
}