From 8ac4bfa0c941acefedf0d384685e8b422fc4b426 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 28 Jun 2020 19:54:01 +0200 Subject: Server::start(): Write HTTP version and status code --- src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 5d26a98..558460f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -253,6 +253,13 @@ impl Server { let (head, body) = response.unwrap().into_parts(); + write!( + &mut stdout, + "HTTP/1.1 {} {}\r\n", + head.status.as_str(), + head.status.canonical_reason().unwrap_or("UNKNOWN"), + ); + for (name, value) in head.headers.iter() { write!(&mut stdout, "{}: ", name).unwrap(); stdout.write(value.as_bytes()).unwrap(); -- cgit v1.2.3