Skip to content

Commit

Permalink
Static files are incorrectly served as both chunked and with length a…
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed Jun 1, 2019
1 parent 666756b commit 15cdc68
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions actix-files/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes

## [0.1.1] - 2019-06-01

* Static files are incorrectly served as both chunked and with length #812

## [0.1.0] - 2019-05-25

* NamedFile last-modified check always fails due to nano-seconds
Expand Down
1 change: 1 addition & 0 deletions actix-files/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ path = "src/lib.rs"

[dependencies]
actix-web = "1.0.0-rc"
actix-http = "0.2.2"
actix-service = "0.4.0"
bitflags = "1"
bytes = "0.4"
Expand Down
3 changes: 2 additions & 1 deletion actix-files/src/named.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use bitflags::bitflags;
use mime;
use mime_guess::guess_mime_type;

use actix_http::body::SizedStream;
use actix_web::http::header::{
self, ContentDisposition, DispositionParam, DispositionType,
};
Expand Down Expand Up @@ -434,7 +435,7 @@ impl Responder for NamedFile {
if offset != 0 || length != self.md.len() {
return Ok(resp.status(StatusCode::PARTIAL_CONTENT).streaming(reader));
};
Ok(resp.streaming(reader))
Ok(resp.body(SizedStream::new(length, reader)))
}
}
}
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pub use actix_web_codegen::*;

// re-export for convenience
pub use actix_http::Response as HttpResponse;
pub use actix_http::{cookie, http, Error, HttpMessage, ResponseError, Result};
pub use actix_http::{body, cookie, http, Error, HttpMessage, ResponseError, Result};

pub use crate::app::App;
pub use crate::extract::FromRequest;
Expand Down Expand Up @@ -143,7 +143,7 @@ pub mod dev {
pub use crate::types::json::JsonBody;
pub use crate::types::readlines::Readlines;

pub use actix_http::body::{Body, BodySize, MessageBody, ResponseBody};
pub use actix_http::body::{Body, BodySize, MessageBody, ResponseBody, SizedStream};
pub use actix_http::encoding::Decoder as Decompress;
pub use actix_http::ResponseBuilder as HttpResponseBuilder;
pub use actix_http::{
Expand Down

0 comments on commit 15cdc68

Please sign in to comment.