mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-23 23:51:06 +01:00
Do not compress NoContent (204) responses #918
This commit is contained in:
parent
eaa371db8b
commit
7c0f570845
@ -89,10 +89,10 @@ actix-cors = { version = "0.1.0", optional = true }
|
||||
actix-identity = { version = "0.1.0", optional = true }
|
||||
|
||||
bytes = "0.4"
|
||||
derive_more = "0.14"
|
||||
derive_more = "0.15.0"
|
||||
encoding = "0.2"
|
||||
futures = "0.1.25"
|
||||
hashbrown = "0.3.1"
|
||||
hashbrown = "0.5.0"
|
||||
log = "0.4"
|
||||
mime = "0.3"
|
||||
net2 = "0.2.33"
|
||||
|
@ -1,5 +1,12 @@
|
||||
# Changes
|
||||
|
||||
## [0.2.4] - 2019-06-16
|
||||
|
||||
### Fixed
|
||||
|
||||
* Do not compress NoContent (204) responses #918
|
||||
|
||||
|
||||
## [0.2.3] - 2019-06-02
|
||||
|
||||
### Added
|
||||
|
@ -56,11 +56,11 @@ bitflags = "1.0"
|
||||
bytes = "0.4"
|
||||
byteorder = "1.2"
|
||||
copyless = "0.1.2"
|
||||
derive_more = "0.14"
|
||||
derive_more = "0.15.0"
|
||||
either = "1.5.2"
|
||||
encoding = "0.2"
|
||||
futures = "0.1.25"
|
||||
hashbrown = "0.3.0"
|
||||
hashbrown = "0.5.0"
|
||||
h2 = "0.1.16"
|
||||
http = "0.1.17"
|
||||
httparse = "1.3"
|
||||
|
@ -33,6 +33,7 @@ impl<B: MessageBody> Encoder<B> {
|
||||
) -> ResponseBody<Encoder<B>> {
|
||||
let can_encode = !(head.headers().contains_key(&CONTENT_ENCODING)
|
||||
|| head.status == StatusCode::SWITCHING_PROTOCOLS
|
||||
|| head.status == StatusCode::NO_CONTENT
|
||||
|| encoding == ContentEncoding::Identity
|
||||
|| encoding == ContentEncoding::Auto);
|
||||
|
||||
@ -122,6 +123,7 @@ impl<B: MessageBody> MessageBody for Encoder<B> {
|
||||
Async::NotReady => return Ok(Async::NotReady),
|
||||
Async::Ready(Some(chunk)) => {
|
||||
if let Some(mut encoder) = self.encoder.take() {
|
||||
self.encoded += chunk.len();
|
||||
if chunk.len() < INPLACE {
|
||||
encoder.write(&chunk)?;
|
||||
let chunk = encoder.take();
|
||||
|
Loading…
Reference in New Issue
Block a user