Skip to main content

logicaffeine_system/http/
mod.rs

1//! A native HTTP/1.1 server — the runtime a LOGOS program's `Serve` statement
2//! executes on.
3//!
4//! Two layers, split so the protocol is swappable:
5//! - [`wire`] is a pure, dependency-free HTTP/1.1 parser + writer over plain
6//!   byte buffers (hand-rolled, matching the repo's self-contained crypto
7//!   ethos — no hyper): the server half (`parse_request`/`serialize_response`)
8//!   and its exact client-side mirror (`serialize_request`/`parse_response`).
9//! - `server` (added alongside) is a tokio accept loop generic over a handler,
10//!   sitting behind an internal transport boundary so a hyper-backed transport
11//!   can drop in later without touching the LOGOS handler bridge or the wire types.
12//!
13//! Above them, [`engine`] holds the ENGINE knob: the serve entries pick
14//! between the portable tokio loop and the Linux thread-per-core io_uring
15//! engine (`engine_uring`, behind the `io-uring` feature) via
16//! `LOGOS_HTTP_ENGINE`, defaulting to the fast path wherever a ring
17//! initializes — always announced on stderr, and byte-identical on the wire
18//! (both engines speak through the same [`wire`] core).
19//!
20//! Native only, behind the `http` feature.
21
22pub mod engine;
23#[cfg(all(target_os = "linux", feature = "io-uring"))]
24pub mod engine_uring;
25pub mod lifecycle;
26pub mod server;
27pub mod wire;
28
29pub use engine::{EngineChoice, EngineKind, StaticResponses};
30pub use lifecycle::{
31    service_unavailable, shutdown_requested, Admission, DrainOutcome, Lifecycle, LifecycleConfig,
32    CORRELATION_HEADER,
33};
34pub use server::{
35    serve, serve_with_statics, spawn, spawn_with_lifecycle, Conn, HttpServer, Listener, ReadError,
36};
37pub use wire::{
38    parse_request, parse_response, serialize_request, serialize_response, HttpRequest,
39    HttpResponse, ParseError, MAX_BODY,
40};