Rocket

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 995603666f855dc9923508446e0abb611cd478f5
parent f941b1310b50292749bc030b1bf5e1ef57cdf0f5
Author: Ryan <ryan@>
Date:   Thu, 19 Jul 2018 15:55:43 -0700

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.

Diffstat:
Mcore/lib/src/data/data_stream.rs | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/lib/src/data/data_stream.rs b/core/lib/src/data/data_stream.rs @@ -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); } }