mirror of https://github.com/fafhrd91/actix-web
content-length bug fix
This commit is contained in:
parent
eed377e773
commit
c871988bcc
|
@ -11,7 +11,7 @@ use flate2::write::{GzEncoder, ZlibEncoder};
|
||||||
#[cfg(feature = "flate2")]
|
#[cfg(feature = "flate2")]
|
||||||
use flate2::Compression;
|
use flate2::Compression;
|
||||||
use http::header::{ACCEPT_ENCODING, CONTENT_LENGTH};
|
use http::header::{ACCEPT_ENCODING, CONTENT_LENGTH};
|
||||||
use http::Version;
|
use http::{StatusCode, Version};
|
||||||
|
|
||||||
use super::message::InnerRequest;
|
use super::message::InnerRequest;
|
||||||
use body::{Binary, Body};
|
use body::{Binary, Body};
|
||||||
|
@ -192,7 +192,13 @@ impl Output {
|
||||||
let transfer = match resp.body() {
|
let transfer = match resp.body() {
|
||||||
Body::Empty => {
|
Body::Empty => {
|
||||||
if !info.head {
|
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);
|
*self = Output::Empty(buf);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue