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