Add proper path parsing, add echo
Change-Id: Idd40fcffe1d9a7f567d9b41db5bc2f5f40b6cdbb
Reviewed-on: https://git.clicks.codes/c/Clicks/BYO/HttpServer/rust/+/250
Tested-by: Skyler Grey <minion@clicks.codes>
Reviewed-by: Samuel Shuert <coded@clicks.codes>
diff --git a/src/main.rs b/src/main.rs
index c24bdb2..d9d8c22 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -15,11 +15,11 @@
let mut buf: [u8; 1] = [0; 1];
_stream.read_exact(&mut buf).unwrap();
- request[part].push(buf[0].into());
-
if buf[0] == b' ' {
part += 1;
request.push(vec![]);
+ } else {
+ request[part].push(buf[0].into());
}
if part == 2 {
@@ -34,6 +34,8 @@
let mut response_headers: Vec<String> = vec![];
let response_body: &str;
+ // println!("{:?}", path);
+
path.next().unwrap();
match path.next().unwrap() {