mirror of
https://github.com/fafhrd91/actix-web
synced 2025-01-18 05:41:50 +01:00
do not read head payload
This commit is contained in:
parent
2a25caf2c5
commit
9070d59ea8
@ -17,6 +17,7 @@ use context::{ActorHttpContext, Frame};
|
|||||||
use error::Error;
|
use error::Error;
|
||||||
use error::PayloadError;
|
use error::PayloadError;
|
||||||
use header::ContentEncoding;
|
use header::ContentEncoding;
|
||||||
|
use http::Method;
|
||||||
use httpmessage::HttpMessage;
|
use httpmessage::HttpMessage;
|
||||||
use server::input::PayloadStream;
|
use server::input::PayloadStream;
|
||||||
use server::WriterState;
|
use server::WriterState;
|
||||||
@ -212,6 +213,9 @@ impl Future for SendRequest {
|
|||||||
|
|
||||||
match pl.parse() {
|
match pl.parse() {
|
||||||
Ok(Async::Ready(mut resp)) => {
|
Ok(Async::Ready(mut resp)) => {
|
||||||
|
if self.req.method() == &Method::HEAD {
|
||||||
|
pl.parser.take();
|
||||||
|
}
|
||||||
resp.set_pipeline(pl);
|
resp.set_pipeline(pl);
|
||||||
return Ok(Async::Ready(resp));
|
return Ok(Async::Ready(resp));
|
||||||
}
|
}
|
||||||
|
@ -368,8 +368,8 @@ fn test_head_empty() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
// let bytes = srv.execute(response.body()).unwrap();
|
let bytes = srv.execute(response.body()).unwrap();
|
||||||
// assert!(bytes.is_empty());
|
assert!(bytes.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -396,8 +396,8 @@ fn test_head_binary() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
//let bytes = srv.execute(response.body()).unwrap();
|
let bytes = srv.execute(response.body()).unwrap();
|
||||||
//assert!(bytes.is_empty());
|
assert!(bytes.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user