reading the body causes an infinite loop

This commit is contained in:
2025-03-20 22:47:52 +01:00
parent 30508bd5a9
commit 26712c8433

View File

@ -3,7 +3,7 @@ use std::{
collections::HashMap,
error::Error,
fs::{self},
io::{BufRead, BufReader, Read, Write},
io::{BufRead, BufReader, Write},
net::{TcpListener, TcpStream},
path::PathBuf,
process::exit,
@ -408,9 +408,10 @@ fn handle_request(mut stream: TcpStream) -> Result<(), Box<dyn Error>> {
return Ok(());
}
};
dbg!(&field_lines);
let mut request_body: Vec<u8> = vec![];
reader.read_to_end(&mut request_body)?;
// let mut request_body: Vec<u8> = vec![];
// reader.read_to_end(&mut request_body)?;
let response = match start_line.target.as_str() {
// For docker healtcheck. If the server can properly respond, then it must be healthy.