Merge pull request #560 from yin1999/patch-1

修复示例代码中的`HTTP/1.x`格式错误
This commit is contained in:
KaiserY 2021-11-09 11:10:39 +08:00 committed by GitHub
commit 3c76a40167
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -371,9 +371,9 @@ fn handle_connection(mut stream: TcpStream) {
// --snip--
let (status_line, filename) = if buffer.starts_with(get) {
("HTTP/1.1 200 OK\r\n\r\n", "hello.html")
("HTTP/1.1 200 OK", "hello.html")
} else {
("HTTP/1.1 404 NOT FOUND\r\n\r\n", "404.html")
("HTTP/1.1 404 NOT FOUND", "404.html")
};
let contents = fs::read_to_string(filename).unwrap();