http-request 23.3.0

http-request is a lightweight, efficient library for building, sending, and handling HTTP/HTTPS requests in Rust applications. It provides a simple and intuitive API, allowing developers to easily interact with web services, whether they use the "HTTP" or "HTTPS" protocol. The library supports various HTTP methods, custom headers, request bodies, timeout, automatic handling of redirects (including detecting redirect loops), and enhanced response body decoding (both automatic and manual), enabling fast and secure communication. Whether working with secure "HTTPS" connections or standard "HTTP" requests, the library is optimized for performance, minimal resource usage, and easy integration into Rust projects.
Documentation
use super::*;

/// Fully parsed and validated final HTTP/1 response head produced in a single scan pass.
pub(crate) struct ParsedFinalHead {
    /// Byte offset where the response body begins (immediately after `\r\n\r\n`).
    pub(crate) head_end: usize,
    /// Resolved body framing (`Fixed`, `Chunked`, or `Close`).
    pub(crate) framing: ResponseFraming,
    /// Optional raw `Location` header value on `3xx` redirect responses.
    pub(crate) redirect_url: Option<Vec<u8>>,
    /// Whether HTTP version and `Connection` headers permit keep-alive pool reuse.
    pub(crate) allows_keep_alive: bool,
    /// Parsed HTTP version.
    pub(crate) version: HttpVersion,
    /// Parsed 3-digit HTTP status code.
    pub(crate) status_code: usize,
    /// Parsed status reason phrase.
    pub(crate) reason_phrase: String,
    /// Lowercased response header map populated in the same validation pass.
    pub(crate) headers: HashMapXxHash3_64<String, String>,
}

/// Incremental single-pass O(N) HTTP/1.1 chunked transfer-encoding decoder.
pub(crate) struct ChunkedDecoder {
    /// Current unread byte offset inside the wire body slice.
    pub(crate) cursor: usize,
    /// Decoded payload bytes accumulated incrementally across reads.
    pub(crate) decoded: Vec<u8>,
    /// Final wire offset immediately after the terminating `0\r\n[trailers]\r\n` block.
    pub(crate) wire_end: Option<usize>,
}