feat(http): basic request parsing done

This commit is contained in:
2024-11-28 13:48:42 +01:00
parent 2597cf4ef0
commit 39efdcb970
2 changed files with 56 additions and 36 deletions

View File

@@ -16,20 +16,8 @@ fn main() {
let response = http::process_petition(&mut _stream);
// TODO: manage error case
match response {
Ok(data) => {
let _amount = _stream.write(data.data.as_bytes()).unwrap();
}
Err(e) => {
println!("Error: {:?}", e);
let _amount = _stream
.write(
"HTTP/1.1 500 Internal Server Error\r\nContent-Length: 0\r\n\r\n"
.as_bytes(),
)
.unwrap();
}
}
println!("About to responde: {:?}", response);
let _amount = _stream.write(response.data.as_bytes()).unwrap();
_stream.flush().unwrap();
}
}