mirror of https://github.com/rwf2/Rocket.git
Force close only the read end of connections.
Previously, when a request's body data exceeded the expected length, Rocket would shutdown both ends of the corresponding connection. This PR changes the behavior so that only the read end of the connection, on Rocket's side, is shutdown. This allows a response to be sent in the future while still preventing DoS attacks due to exuberant data. Fixes #386.
This commit is contained in:
parent
b33f75614e
commit
dbcb99ecf2
|
@ -40,7 +40,7 @@ pub fn kill_stream(stream: &mut BodyReader) {
|
|||
Ok(FLUSH_LEN) | Err(_) => {
|
||||
warn_!("Data left unread. Force closing network stream.");
|
||||
let (_, network) = stream.get_mut().get_mut();
|
||||
if let Err(e) = network.close(Shutdown::Both) {
|
||||
if let Err(e) = network.close(Shutdown::Read) {
|
||||
error_!("Failed to close network stream: {:?}", e);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue