http_extract/lib.rs
1//! Strict, trust-aware extraction of HTTP request metadata.
2//!
3//! This crate operates primarily on [`http`] types and does not require a web
4//! framework, Tower, tracing, or OpenTelemetry. An opt-in `axum` feature adds
5//! only transport-peer extraction from Axum request extensions. Forwarding
6//! fields are never trusted implicitly.
7//!
8//! Public modules expose small synchronous extractors for one coherent field
9//! responsibility. Applications compose only the modules they need at their
10//! framework boundary; this crate does not impose a request-context aggregate
11//! or an asynchronous adapter. Cargo features gate field-specific modules;
12//! disabling default features leaves the shared [`header`] helpers and [`Error`]
13//! available, and enabling a feature exposes only its documented module and
14//! dependencies.
15
16#![doc = include_str!("../README.md")]
17#![deny(unsafe_code)]
18#![warn(missing_docs, missing_debug_implementations)]
19
20#[cfg(feature = "api-key")]
21pub mod api_key;
22
23#[cfg(feature = "authority")]
24pub mod authority;
25#[cfg(feature = "authorization")]
26pub mod authorization;
27#[cfg(feature = "client-ip")]
28pub mod client_ip;
29#[cfg(feature = "client-ip-headers")]
30pub mod client_ip_headers;
31#[cfg(feature = "content-type")]
32pub mod content_type;
33#[cfg(feature = "forwarded")]
34pub mod forwarded;
35
36// extract header module
37pub mod header;
38
39#[cfg(feature = "request-id")]
40pub mod request_id;
41#[cfg(feature = "x-forwarded")]
42pub mod x_forwarded;
43
44mod error;
45
46pub use error::Error;
47
48pub use http::{HeaderMap, HeaderName, HeaderValue, Request};