(mut stream: TcpStream)
| 9 | } |
| 10 | |
| 11 | fn handle_stream(mut stream: TcpStream) { |
| 12 | let mut buffer = [0; 1024]; |
| 13 | stream.read_exact(&mut buffer).unwrap(); |
| 14 | println!("Request: {}", String::from_utf8_lossy(&buffer[..])); |
| 15 | |
| 16 | let response = "HTTP/1.1 200 OK\r\n\r\n"; |
| 17 | stream.write_all(response.as_bytes()).unwrap(); |
| 18 | stream.flush().unwrap(); |
| 19 | } |