X-Git-Url: https://piware.de/gitweb/?p=learn-rust.git;a=blobdiff_plain;f=async-http%2Fsrc%2Fmain.rs;h=95e7f07687562f23df7591299f18a0066290fd2f;hp=d9e3a26bfaf8c22af808f51a61e1f50b09534a17;hb=6a8be44a0b7527d9250309258d3055bbce125328;hpb=700074ce7c06235b6ae17e2a165301f2fe6374ed diff --git a/async-http/src/main.rs b/async-http/src/main.rs index d9e3a26..95e7f07 100644 --- a/async-http/src/main.rs +++ b/async-http/src/main.rs @@ -12,7 +12,6 @@ fn main() { // Block forever, handling each request that arrives at this IP address for stream in listener.incoming() { let stream = stream.unwrap(); - handle_connection(stream); } } @@ -20,7 +19,7 @@ fn main() { fn handle_connection(mut stream: TcpStream) { // Read the first 1024 bytes of data from the stream let mut buffer = [0; 1024]; - stream.read(&mut buffer).unwrap(); + assert!(stream.read(&mut buffer).unwrap() > 0); let get = b"GET / HTTP/1.1\r\n";