1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 22:49:21 +02:00

Move BodyEncoding to dev module #1220

This commit is contained in:
Nikolay Kim
2019-12-16 17:22:26 +06:00
parent b0aa9395da
commit 01613f334b
7 changed files with 64 additions and 32 deletions

View File

@ -1,6 +1,10 @@
# Changes
## [0.2.0-alpha.7] - 2019-12-07
## [0.2.0] - 2019-12-xx
* Fix BodyEncoding trait import #1220
## [0.2.0-alpha.1] - 2019-12-07
* Migrate to `std::future`

View File

@ -18,7 +18,7 @@ name = "actix_files"
path = "src/lib.rs"
[dependencies]
actix-web = { version = "2.0.0-alpha.5", default-features = false }
actix-web = { version = "2.0.0-alpha.6", default-features = false }
actix-http = "1.0.0"
actix-service = "1.0.0"
bitflags = "1"
@ -33,4 +33,4 @@ v_htmlescape = "0.4"
[dev-dependencies]
actix-rt = "1.0.0"
actix-web = { version = "2.0.0-alpha.5", features=["openssl"] }
actix-web = { version = "2.0.0-alpha.6", features=["openssl"] }

View File

@ -12,11 +12,11 @@ use mime;
use mime_guess::from_path;
use actix_http::body::SizedStream;
use actix_web::dev::BodyEncoding;
use actix_web::http::header::{
self, Charset, ContentDisposition, DispositionParam, DispositionType, ExtendedValue,
};
use actix_web::http::{ContentEncoding, StatusCode};
use actix_web::middleware::BodyEncoding;
use actix_web::{Error, HttpMessage, HttpRequest, HttpResponse, Responder};
use futures::future::{ready, Ready};
@ -268,7 +268,7 @@ impl NamedFile {
);
});
if let Some(current_encoding) = self.encoding {
resp.encoding(current_encoding);
resp.set_encoding(current_encoding);
}
let reader = ChunkedReadFile {
size: self.md.len(),
@ -335,7 +335,7 @@ impl NamedFile {
});
// default compressing
if let Some(current_encoding) = self.encoding {
resp.encoding(current_encoding);
resp.set_encoding(current_encoding);
}
resp.if_some(last_modified, |lm, resp| {
@ -356,7 +356,7 @@ impl NamedFile {
if let Ok(rangesvec) = HttpRange::parse(rangesheader, length) {
length = rangesvec[0].length;
offset = rangesvec[0].start;
resp.encoding(ContentEncoding::Identity);
resp.set_encoding(ContentEncoding::Identity);
resp.header(
header::CONTENT_RANGE,
format!(