This commit is contained in:
Omid Rad 2020-05-08 19:09:21 +02:00
parent b521e9b221
commit c0e7caed67
2 changed files with 3 additions and 2 deletions

View File

@ -584,7 +584,8 @@ impl Service for FilesService {
named_file.flags = self.file_flags;
let (req, _) = req.into_parts();
match named_file.into_response(&req) {
Ok(item) => {
Ok(mut item) => {
item.head_mut().no_chunking(true);
Either::Left(ok(ServiceResponse::new(req.clone(), item)))
}
Err(e) => Either::Left(ok(ServiceResponse::from_err(e, req))),

View File

@ -388,7 +388,7 @@ impl NamedFile {
fut: None,
counter: 0,
};
if offset != 0 || length != self.md.len() {
if offset != 0 {
Ok(resp.status(StatusCode::PARTIAL_CONTENT).streaming(reader))
} else {
Ok(resp.body(SizedStream::new(length, reader)))