Skip to main content

build_http_request_head

Function build_http_request_head 

Source
pub fn build_http_request_head(
    method: &str,
    target: &str,
    host: &str,
    content_length: Option<usize>,
    headers: &[(String, String)],
) -> Result<String, NetError>
Expand description

Build a simple HTTP/1.1 request head.

This is a policy-free formatter: callers choose the method, target, headers, content length, and transport. The helper rejects CR/LF injection and malformed method/header names, then emits a Connection: close head so socket callers can use response EOF as a body boundary when needed.