diff --git a/CHANGES.md b/CHANGES.md index cfae08f8..95eecbf8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,7 +2,9 @@ ## 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) diff --git a/src/server/encoding.rs b/src/server/encoding.rs index deb4a543..1fda25a3 100644 --- a/src/server/encoding.rs +++ b/src/server/encoding.rs @@ -483,14 +483,16 @@ impl PayloadEncoder { } } else { // Enable transfer encoding - resp.headers_mut().remove(CONTENT_LENGTH); - if version == Version::HTTP_2 { - resp.headers_mut().remove(TRANSFER_ENCODING); - TransferEncoding::eof(buf) - } else { - resp.headers_mut().insert( - TRANSFER_ENCODING, HeaderValue::from_static("chunked")); - TransferEncoding::chunked(buf) + match version { + Version::HTTP_11 => { + resp.headers_mut().insert( + TRANSFER_ENCODING, HeaderValue::from_static("chunked")); + TransferEncoding::chunked(buf) + }, + _ => { + resp.headers_mut().remove(TRANSFER_ENCODING); + TransferEncoding::eof(buf) + } } } }