From: Martin Pitt Date: Sat, 11 Sep 2021 09:36:22 +0000 (+0200) Subject: simple-http: Naïve unlimited threads X-Git-Url: https://piware.de/gitweb/?p=learn-rust.git;a=commitdiff_plain;h=30342e681c6db184ebca5aa2c30ee8bb7f60470d;hp=4ccd093f060dfe589c0ec86e9047e350f50550f1 simple-http: Naïve unlimited threads This introduces a DoS with too many parallel requests. --- diff --git a/simple-http/src/main.rs b/simple-http/src/main.rs index d2d0f88..0993075 100644 --- a/simple-http/src/main.rs +++ b/simple-http/src/main.rs @@ -64,6 +64,6 @@ fn main() { for stream in listener.incoming() { let stream = stream.unwrap(); - handle_connection(stream); + thread::spawn(|| handle_connection(stream)); } }