Skip to main content

read_http_request_with_line

Function read_http_request_with_line 

Source
pub fn read_http_request_with_line(
    stream: &mut TcpStream,
    line: &[u8],
    deadline: Instant,
    max_header_bytes: usize,
    max_body_bytes: usize,
) -> Result<Vec<u8>>
Expand description

Complete a bounded request after read_http_request_line on the same socket.

Preserves the caller’s original deadline across both phases, includes the line in the returned bytes/header budget, and uses read_http_request’s framing admission. The caller may instead retain an incomplete socket without calling this function, for example while another request determines a cancellation. This never reopens the socket or reads the request line a second time.

§Errors

Returns framing, resource, deadline and I/O failures; malformed prefetched lines refuse.