pub fn read_http_request(
stream: &mut TcpStream,
timeout: Duration,
max_header_bytes: usize,
max_body_bytes: usize,
) -> Result<Vec<u8>>Expand description
Read one bounded raw HTTP request from an accepted test socket.
Selects blocking reads explicitly, including sockets inheriting nonblocking mode on macOS. Every read uses the remaining single deadline. Missing Content-Length means no body; repeated/invalid lengths and transfer encoding are rejected. This helper does not authenticate or interpret application data. The caller owns responses, write timeouts and failure injection.