From bb2e683f20ef27446c8c4e58a4a99f26b3dad6d1 Mon Sep 17 00:00:00 2001 From: AustrianToast Date: Thu, 20 Mar 2025 23:28:15 +0100 Subject: [PATCH] use as_bytes() instead of b --- src/main.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 575c44f..25a5da2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -187,7 +187,8 @@ fn parse_field_lines( reader.read_line(&mut line).unwrap(); if !line.ends_with("\r\n") { - b"Lines need to end with a CRLF" + "Lines need to end with a CRLF" + .as_bytes() .iter() .for_each(|byte| response_body.push(*byte)); @@ -212,7 +213,8 @@ fn parse_field_lines( let field_line = match line.split_once(":") { Some(val) => val, None => { - b"Invalid field-line" + "Invalid field-line" + .as_bytes() .iter() .for_each(|byte| response_body.push(*byte)); @@ -236,7 +238,8 @@ fn parse_field_lines( } if !field_lines.contains_key(&String::from("Host")) { - b"field-line with key HOST is missing" + "field-line with key HOST is missing" + .as_bytes() .iter() .for_each(|byte| response_body.push(*byte)); @@ -372,7 +375,8 @@ fn handle_request(mut stream: TcpStream) -> Result<(), Box> { } if line.ends_with(" ") { - b"There is whitespace between the start-line and the first field-line" + "There is whitespace between the start-line and the first field-line" + .as_bytes() .iter() .for_each(|byte| response_body.push(*byte));