From d5920d405f777aa5423621ca4f8d858fcab4d4dd Mon Sep 17 00:00:00 2001 From: Laurence Tratt Date: Mon, 25 Dec 2023 09:57:57 +0000 Subject: [PATCH] Return correctly formatted empty-body HTTP responses. --- src/server/http_server.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/http_server.rs b/src/server/http_server.rs index 8df06f3..c30e137 100644 --- a/src/server/http_server.rs +++ b/src/server/http_server.rs @@ -337,11 +337,11 @@ fn http_200(mut stream: TcpStream, body: &str) { } fn http_404(mut stream: TcpStream) { - stream.write_all(b"HTTP/1.1 404").ok(); + stream.write_all(b"HTTP/1.1 404\r\n\r\n").ok(); } fn http_400(mut stream: TcpStream) { - stream.write_all(b"HTTP/1.1 400").ok(); + stream.write_all(b"HTTP/1.1 400\r\n\r\n").ok(); } pub fn http_server_setup(conf: &Config) -> Result<(u16, TcpListener), Box> {