mirror of
https://github.com/fafhrd91/actix-web
synced 2025-07-20 00:06:12 +02:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
db0091ba6f | ||
|
2159158c30 | ||
|
76d790425f | ||
|
90968d4333 | ||
|
577a509875 |
@@ -1,5 +1,12 @@
|
||||
# Changes
|
||||
|
||||
## 0.6.9 (2018-05-22)
|
||||
|
||||
* Drop connection if request's payload is not fully consumed #236
|
||||
|
||||
* Fix streaming response with body compression
|
||||
|
||||
|
||||
## 0.6.8 (2018-05-20)
|
||||
|
||||
* Fix scope resource path extractor #234
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "actix-web"
|
||||
version = "0.6.8"
|
||||
version = "0.6.9"
|
||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||
description = "Actix web is a simple, pragmatic and extremely fast web framework for Rust."
|
||||
readme = "README.md"
|
||||
|
21
src/fs.rs
21
src/fs.rs
@@ -20,7 +20,7 @@ use mime_guess::{get_mime_type, guess_mime_type};
|
||||
use error::Error;
|
||||
use handler::{AsyncResult, Handler, Responder, RouteHandler, WrapHandler};
|
||||
use header;
|
||||
use http::{HttpRange, Method, StatusCode};
|
||||
use http::{HttpRange, Method, StatusCode, ContentEncoding};
|
||||
use httpmessage::HttpMessage;
|
||||
use httprequest::HttpRequest;
|
||||
use httpresponse::HttpResponse;
|
||||
@@ -300,6 +300,7 @@ impl Responder for NamedFile {
|
||||
if let Ok(rangesvec) = HttpRange::parse(rangesheader, length) {
|
||||
length = rangesvec[0].length;
|
||||
offset = rangesvec[0].start;
|
||||
resp.content_encoding(ContentEncoding::Identity);
|
||||
resp.header(
|
||||
header::CONTENT_RANGE,
|
||||
format!(
|
||||
@@ -898,6 +899,7 @@ mod tests {
|
||||
let request = srv
|
||||
.get()
|
||||
.uri(srv.url("/t%65st/tests/test.binary"))
|
||||
.no_default_headers()
|
||||
.finish()
|
||||
.unwrap();
|
||||
|
||||
@@ -911,6 +913,23 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(contentlength, "100");
|
||||
|
||||
// chunked
|
||||
let request = srv
|
||||
.get()
|
||||
.uri(srv.url("/t%65st/tests/test.binary"))
|
||||
.finish()
|
||||
.unwrap();
|
||||
|
||||
let response = srv.execute(request.send()).unwrap();
|
||||
|
||||
let te = response
|
||||
.headers()
|
||||
.get(header::TRANSFER_ENCODING)
|
||||
.unwrap()
|
||||
.to_str()
|
||||
.unwrap();
|
||||
assert_eq!(te, "chunked");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@@ -505,6 +505,11 @@ impl ContentEncoder {
|
||||
}
|
||||
TransferEncoding::eof(buf)
|
||||
} else {
|
||||
if !(encoding == ContentEncoding::Identity
|
||||
|| encoding == ContentEncoding::Auto)
|
||||
{
|
||||
resp.headers_mut().remove(CONTENT_LENGTH);
|
||||
}
|
||||
ContentEncoder::streaming_encoding(buf, version, resp)
|
||||
}
|
||||
}
|
||||
|
@@ -270,7 +270,12 @@ where
|
||||
debug!("Error sending data: {}", err);
|
||||
return Err(());
|
||||
}
|
||||
_ => (),
|
||||
Ok(Async::Ready(_)) => {
|
||||
// non consumed payload in that case close connection
|
||||
if self.payload.is_some() && self.tasks.is_empty() {
|
||||
return Ok(Async::Ready(false))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -54,6 +54,7 @@ const STR: &str = "Hello World Hello World Hello World Hello World Hello World \
|
||||
Hello World Hello World Hello World Hello World Hello World";
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_start() {
|
||||
let _ = test::TestServer::unused_addr();
|
||||
let (tx, rx) = mpsc::channel();
|
||||
@@ -96,8 +97,7 @@ fn test_start() {
|
||||
|
||||
// resume
|
||||
let _ = srv_addr.send(server::ResumeServer).wait();
|
||||
thread::sleep(time::Duration::from_millis(200));
|
||||
|
||||
thread::sleep(time::Duration::from_millis(400));
|
||||
{
|
||||
let req = client::ClientRequest::get(format!("http://{}/", addr).as_str())
|
||||
.finish()
|
||||
|
Reference in New Issue
Block a user