diff --git a/src/main.rs b/src/main.rs index 618042a..1232397 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use std::io::Read; +use std::io::{Read, Write}; use std::net::{TcpListener, TcpStream}; fn main() -> std::io::Result<()> { @@ -14,5 +14,9 @@ fn handle_connection(mut stream: TcpStream) -> std::io::Result<()>{ let mut buffer = [0; 1024]; stream.read(&mut buffer)?; println!("Request: {}", String::from_utf8_lossy(&buffer[..])); + + let response = "HTTP/1.1 200 OK\r\n\r\n"; + stream.write(response.as_bytes())?; + stream.flush()?; Ok(()) }