Expand description
HTTP/1.x layer implementation.
This module provides:
- Detection (
detection) — fast byte-slice heuristics. - Request parsing (
request) — zero-copy borrowedHttpRequest. - Response parsing (
response) — zero-copy borrowedHttpResponse. - Builders (
builder) — fluent owned builders for crafting raw bytes. HttpLayer— aLayerimplementation that presents a lazy, index-based view into a packet buffer following the Stackforge “Lazy Zero-Copy View” architecture.
§Architecture
HttpLayer holds only a LayerIndex (start / end byte offsets). All
field values are read on demand, directly from the caller-supplied buffer.
No intermediate allocation is made when the layer is constructed.
§Example
use stackforge_core::layer::http::{HttpLayer, HttpRequestBuilder};
use stackforge_core::layer::{LayerIndex, LayerKind};
let raw = HttpRequestBuilder::new()
.method("GET")
.uri("/api/v1/status")
.header("Host", "example.com")
.build();
let index = LayerIndex::new(LayerKind::Http, 0, raw.len());
let layer = HttpLayer { index };
assert_eq!(layer.method(&raw), Some("GET"));
assert_eq!(layer.uri(&raw), Some("/api/v1/status"));Re-exports§
pub use builder::HttpRequestBuilder;pub use builder::HttpResponseBuilder;pub use request::HttpRequest;pub use response::HttpResponse;
Modules§
- builder
- Fluent builders for serialising HTTP/1.x request and response messages.
- detection
- HTTP traffic detection utilities.
- request
- HTTP/1.x request parsing (borrowed, zero-copy view).
- response
- HTTP/1.x response parsing (borrowed, zero-copy view).
Structs§
- Http
Layer - Lazy, index-based view of an HTTP/1.x message inside a packet buffer.
Constants§
- HTTP_
FIELD_ NAMES - Canonical field names exposed by
HttpLayer.