mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-28 09:42:40 +01:00
close conneciton for head requests
This commit is contained in:
parent
a5f7a67b4d
commit
cfa470db50
@ -202,6 +202,7 @@ impl Future for SendRequest {
|
|||||||
should_decompress: self.req.response_decompress(),
|
should_decompress: self.req.response_decompress(),
|
||||||
write_state: RunningState::Running,
|
write_state: RunningState::Running,
|
||||||
timeout: Some(timeout),
|
timeout: Some(timeout),
|
||||||
|
close: self.req.method() == &Method::HEAD,
|
||||||
});
|
});
|
||||||
self.state = State::Send(pl);
|
self.state = State::Send(pl);
|
||||||
}
|
}
|
||||||
@ -247,6 +248,7 @@ pub struct Pipeline {
|
|||||||
should_decompress: bool,
|
should_decompress: bool,
|
||||||
write_state: RunningState,
|
write_state: RunningState,
|
||||||
timeout: Option<Delay>,
|
timeout: Option<Delay>,
|
||||||
|
close: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum IoBody {
|
enum IoBody {
|
||||||
@ -280,7 +282,11 @@ impl RunningState {
|
|||||||
impl Pipeline {
|
impl Pipeline {
|
||||||
fn release_conn(&mut self) {
|
fn release_conn(&mut self) {
|
||||||
if let Some(conn) = self.conn.take() {
|
if let Some(conn) = self.conn.take() {
|
||||||
conn.release()
|
if self.close {
|
||||||
|
conn.close()
|
||||||
|
} else {
|
||||||
|
conn.release()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user