1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-25 18:09:22 +02:00

content-length bug fix (#525)

* content-length bug fix

* changes.md is updated

* typo
This commit is contained in:
Danil Berestov
2018-10-03 00:15:48 +08:00
committed by Nikolay Kim
parent eed377e773
commit c8505bb53f
2 changed files with 10 additions and 2 deletions

View File

@ -11,7 +11,7 @@ use flate2::write::{GzEncoder, ZlibEncoder};
#[cfg(feature = "flate2")]
use flate2::Compression;
use http::header::{ACCEPT_ENCODING, CONTENT_LENGTH};
use http::Version;
use http::{StatusCode, Version};
use super::message::InnerRequest;
use body::{Binary, Body};
@ -192,7 +192,13 @@ impl Output {
let transfer = match resp.body() {
Body::Empty => {
if !info.head {
info.length = ResponseLength::Zero;
info.length = match resp.status() {
StatusCode::NO_CONTENT
| StatusCode::CONTINUE
| StatusCode::SWITCHING_PROTOCOLS
| StatusCode::PROCESSING => ResponseLength::None,
_ => ResponseLength::Zero,
};
}
*self = Output::Empty(buf);
return;