From 938e6505928047dc1f03d3744cc692073993ec40 Mon Sep 17 00:00:00 2001 From: William Brawner Date: Wed, 27 Jul 2022 21:19:17 -0600 Subject: [PATCH] Trim \r from command --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 2d13bf6..48b6fc9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -112,7 +112,7 @@ fn handle_connection(mut stream: TcpStream) { let mut request: &str = &String::from_utf8(buffer.to_vec()).expect("Failed to convert command to string"); request = request.trim(); - let trim_chars = [' ', '\n', '\0']; + let trim_chars = [' ', '\r', '\n', '\0']; request = request.trim_matches(&trim_chars[..]); let mut command_iter = request.split_whitespace(); match command_iter.next() {