mirror of https://github.com/fafhrd91/actix-web
Fixes #1384
This commit is contained in:
parent
b521e9b221
commit
c0e7caed67
|
@ -584,7 +584,8 @@ impl Service for FilesService {
|
||||||
named_file.flags = self.file_flags;
|
named_file.flags = self.file_flags;
|
||||||
let (req, _) = req.into_parts();
|
let (req, _) = req.into_parts();
|
||||||
match named_file.into_response(&req) {
|
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)))
|
Either::Left(ok(ServiceResponse::new(req.clone(), item)))
|
||||||
}
|
}
|
||||||
Err(e) => Either::Left(ok(ServiceResponse::from_err(e, req))),
|
Err(e) => Either::Left(ok(ServiceResponse::from_err(e, req))),
|
||||||
|
|
|
@ -388,7 +388,7 @@ impl NamedFile {
|
||||||
fut: None,
|
fut: None,
|
||||||
counter: 0,
|
counter: 0,
|
||||||
};
|
};
|
||||||
if offset != 0 || length != self.md.len() {
|
if offset != 0 {
|
||||||
Ok(resp.status(StatusCode::PARTIAL_CONTENT).streaming(reader))
|
Ok(resp.status(StatusCode::PARTIAL_CONTENT).streaming(reader))
|
||||||
} else {
|
} else {
|
||||||
Ok(resp.body(SizedStream::new(length, reader)))
|
Ok(resp.body(SizedStream::new(length, reader)))
|
||||||
|
|
Loading…
Reference in New Issue