micro_http/protocol/body/
mod.rs

1//! HTTP request body handling implementation.
2//!
3//! This module provides the core abstractions and implementations for handling HTTP request bodies
4//! in an efficient streaming manner. The design focuses on:
5//!
6//! - Memory efficiency through streaming
7//! - Protocol correctness
8//! - Clean abstraction boundaries
9//! - Concurrent processing capabilities
10//!
11//! # Architecture
12//!
13//! The body handling system consists of two main components:
14//!
15//! - [`ReqBody`]: The consumer side that implements `http_body::Body` trait
16//! - [`ReqBodySender`]: The producer side that reads from the raw payload stream
17//!
18//! These components communicate through channels to enable concurrent processing while
19//! maintaining backpressure.
20//!
21//! # Design Goals
22//!
23//! 1. **Memory Efficiency**
24//!    - Stream body chunks instead of buffering entire payload
25//!    - Implement backpressure to prevent overwhelming memory
26//!
27//! 2. **Protocol Correctness**
28//!    - Ensure complete body consumption even if handler abandons reading
29//!    - Maintain proper connection state for keep-alive support
30//!
31//! 3. **Concurrent Processing**
32//!    - Allow request handling to proceed while body streams
33//!    - Support cancellation and cleanup in error cases
34//!
35//! 4. **Clean Abstractions**
36//!    - Hide channel complexity from consumers
37//!    - Provide standard http_body::Body interface
38//!
39//! # Implementation Details
40//!
41//! The body handling implementation uses:
42//!
43//! - MPSC channel for signaling between consumer and producer
44//! - Oneshot channels for individual chunk transfers
45//! - EOF tracking to ensure complete body consumption
46//! - Automatic cleanup of unread data
47//!
48//! See individual component documentation for more details.
49
50//mod req_body_2;
51mod body_channel;
52mod req_body;
53
54pub use req_body::ReqBody;