1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-30 18:44:35 +01:00

Do not enable chunked encoding for HTTP/1.0

This commit is contained in:
Nikolay Kim 2018-01-13 12:46:43 -08:00
parent b805d87ee7
commit 305666067e
2 changed files with 13 additions and 9 deletions

View File

@ -2,7 +2,9 @@
## 0.3.1 (2018-01-xx) ## 0.3.1 (2018-01-xx)
* * Fix directory entry path #47
* Do not enable chunked encoding for HTTP/1.0
## 0.3.0 (2018-01-12) ## 0.3.0 (2018-01-12)

View File

@ -483,14 +483,16 @@ impl PayloadEncoder {
} }
} else { } else {
// Enable transfer encoding // Enable transfer encoding
resp.headers_mut().remove(CONTENT_LENGTH); match version {
if version == Version::HTTP_2 { Version::HTTP_11 => {
resp.headers_mut().remove(TRANSFER_ENCODING);
TransferEncoding::eof(buf)
} else {
resp.headers_mut().insert( resp.headers_mut().insert(
TRANSFER_ENCODING, HeaderValue::from_static("chunked")); TRANSFER_ENCODING, HeaderValue::from_static("chunked"));
TransferEncoding::chunked(buf) TransferEncoding::chunked(buf)
},
_ => {
resp.headers_mut().remove(TRANSFER_ENCODING);
TransferEncoding::eof(buf)
}
} }
} }
} }