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::*;

/// Process-wide striped pool of idle asynchronous HTTP/1.1 keep-alive connections.
pub(crate) static ASYNC_H1_POOL: OnceLock<StripedH1Pool<AsyncClientTransport>> = OnceLock::new();

/// Process-wide striped pool of idle synchronous HTTP/1.1 keep-alive connections.
pub(crate) static SYNC_H1_POOL: OnceLock<StripedH1Pool<SyncClientTransport>> = OnceLock::new();

/// Process-wide pool of multiplexed asynchronous HTTP/2 connection senders using read-mostly locking.
pub(crate) static ASYNC_H2_POOL: OnceLock<RwLock<H2PoolList>> = OnceLock::new();

/// Global counter assigning each worker thread a stable initial stripe index.
pub(crate) static NEXT_H1_STRIPE_ID: AtomicUsize = AtomicUsize::new(0);

thread_local! {
    /// Worker-local preferred stripe index (`0..H1_POOL_STRIPES`).
    pub(crate) static WORKER_H1_STRIPE: usize =
        NEXT_H1_STRIPE_ID.fetch_add(1, Ordering::Relaxed) & (H1_POOL_STRIPES - 1);

    /// Thread-local pool of reusable byte buffers avoiding per-request response allocations.
    pub(crate) static CLIENT_BUFFER_POOL: RefCell<Vec<Vec<u8>>> = const { RefCell::new(Vec::new()) };

    /// Pre-zeroed thread-local scratch buffer eliminating per-request zero-fill in synchronous reads.
    pub(crate) static SYNC_READ_SCRATCH: RefCell<Vec<u8>> = const { RefCell::new(Vec::new()) };
}