diff --git a/src/hello.html b/src/hello.html
new file mode 100644
index 0000000..af1799f
--- /dev/null
+++ b/src/hello.html
@@ -0,0 +1,9 @@
+
+
+
+
+ Hello Rustacean!
+
+
+Hello Rustacean!
+
\ No newline at end of file
diff --git a/src/main.rs b/src/main.rs
index 1232397..126a0cc 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -10,12 +10,17 @@ fn main() -> std::io::Result<()> {
Ok(())
}
-fn handle_connection(mut stream: TcpStream) -> std::io::Result<()>{
+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";
+ let contents = include_str!("hello.html");
+ let response = format!(
+ "HTTP/1.1 200 OK\r\nContent-Length: {}\r\n\r\n{}",
+ contents.len(),
+ contents
+ );
stream.write(response.as_bytes())?;
stream.flush()?;
Ok(())