summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index 16d0223..ee71aac 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -18,10 +18,10 @@ pub fn start_server(bind: String) {
fn handle(mut stream: TcpStream) {
let io = BufReader::new(&stream);
let request_line = io.lines().next().unwrap().unwrap();
- let (status_line, filename) = if request_line == "GET / HTTP/1.1" {
- ("HTTP/1.1 200 OK", "./public/index.html")
- } else {
- ("HTTP/1.1 404 NOT FOUND", "./public/404.html")
+
+ let (status_line, filename) = match &request_line[..] {
+ "GET / HTTP/1.1" => ("HTTP/1.1 200 OK", "./public/index.html"),
+ _ => ("HTTP/1.1 404 NOT FOUND", "./public/404.html"),
};
let contents = fs::read_to_string(filename).unwrap();