http-request 23.0.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
/// Hexadecimal uppercase digit table used by percent-encoding and multipart boundaries.
pub(crate) const HEX_UPPER: &[u8; 16] = b"0123456789ABCDEF";

/// Default `application/x-www-form-urlencoded` media type for form request bodies.
pub(crate) const FORM_URLENCODED_CONTENT_TYPE: &str = "application/x-www-form-urlencoded";

/// Default `multipart/form-data` boundary prefix.
pub(crate) const MULTIPART_BOUNDARY_PREFIX: &str = "hyperlane-boundary-";

/// `Authorization` header prefix for Bearer tokens.
pub(crate) const BEARER_PREFIX: &str = "Bearer ";

/// `Authorization` header prefix for HTTP Basic credentials.
pub(crate) const BASIC_PREFIX: &str = "Basic ";

/// HTTP/1.0 version prefix used to distinguish default keep-alive semantics.
pub(crate) const HTTP_1_0_PREFIX: &[u8] = b"HTTP/1.0 ";

/// Error message returned when an HTTP/2 TLS handshake fails to negotiate `h2` ALPN.
pub(crate) const H2_ALPN_MISMATCH: &str = "Server did not negotiate HTTP/2 via ALPN";

/// Maximum stack buffer length for zero-allocation lowercase header lookups.
pub(crate) const RESPONSE_HEADER_STACK_LIMIT: usize = 64;

/// Maximum exponential backoff delay between automatic retries (milliseconds).
pub(crate) const MAX_RETRY_BACKOFF_MS: u64 = 1000;

/// Base exponential backoff delay for the first retry attempt (milliseconds).
pub(crate) const BASE_RETRY_BACKOFF_MS: u64 = 50;

/// Multipart boundary double-dash prefix bytes.
pub(crate) const MULTIPART_DASH_BYTES: &[u8] = b"--";

/// Multipart `Content-Disposition` form-data name header prefix bytes.
pub(crate) const MULTIPART_DISPOSITION_PREFIX: &[u8] = b"Content-Disposition: form-data; name=\"";

/// Multipart filename parameter prefix bytes.
pub(crate) const MULTIPART_FILENAME_PREFIX: &[u8] = b"; filename=\"";

/// Multipart `Content-Type` header prefix bytes.
pub(crate) const MULTIPART_CONTENT_TYPE_PREFIX: &[u8] = b"Content-Type: ";

/// Double-quote byte used in multipart parameters and URL validation.
pub(crate) const QUOTE_U8: u8 = b'"';

/// Underscore replacement byte for unsafe multipart parameter characters.
pub(crate) const UNDERSCORE_U8: u8 = b'_';

/// Hyphen byte allowed inside DNS host labels.
pub(crate) const HYPHEN_U8: u8 = b'-';

/// Forbidden ASCII bytes inside the fast-path URL path component.
pub(crate) const FAST_URL_PATH_FORBIDDEN: &[u8] = b"\\\"<>`{}^";

/// Forbidden ASCII bytes inside the fast-path URL query component.
pub(crate) const FAST_URL_QUERY_FORBIDDEN: &[u8] = b"\"<>`";

/// IDNA punycode label prefix requiring full WHATWG URL host validation.
pub(crate) const PUNYCODE_PREFIX: &str = "xn--";

/// Percent byte introducing percent-encoded sequences in URL paths.
pub(crate) const PERCENT_U8: u8 = b'%';