nitr-http 0.0.0-beta.7

The Nitr HTTP server layer: hyper server, configuration, and the request/response Lua bridge.
Documentation
// SPDX-License-Identifier: MIT OR Apache-2.0
// This file is part of Nitr.
// See https://nitrweb.com/ for more information
// Copyright (C) 2024-present Jose Quintana <joseluisq.net>

//! The Nitr HTTP server layer: hyper server and builder, configuration,
//! and the request/response bridge between HTTP and the Lua runtime.

// Lint policy comes from `[workspace.lints]` in the root Cargo.toml.
// `unwrap_used`/`expect_used` are denied here (not in the workspace table,
// which would also hit test and bench targets); unit tests are exempt, and
// the few documented-invariant `expect()`s carry targeted allows.
#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used))]
#![cfg_attr(docsrs, feature(doc_cfg))]

pub(crate) mod app;
pub(crate) mod compress;
pub(crate) mod config;
pub(crate) mod cors;
pub(crate) mod handler;
pub(crate) mod health;
#[cfg(feature = "multipart")]
pub(crate) mod multipart;
pub(crate) mod openapi;
pub(crate) mod protect;
pub(crate) mod range;
pub(crate) mod request;
pub(crate) mod safe_path;
pub(crate) mod server;
pub(crate) mod static_files;
pub(crate) mod stream;
#[cfg(feature = "tls")]
pub(crate) mod tls;
pub(crate) mod validation;
pub(crate) mod watch;

pub mod testing;

/// Internal functions exposed for the fuzz targets in `fuzz/` only.
/// Not part of the public API; no stability promise applies here.
#[doc(hidden)]
pub mod fuzzing {
    pub use crate::compress::{Compression, Encoding, parse_accept_encoding};
    #[cfg(feature = "multipart")]
    pub use crate::multipart::{
        consume_for_fuzzing as consume_multipart, resolve_upload_path as resolve_upload,
        safe_filename,
    };
    pub use crate::range::{
        Resolved, if_range_matches, parse as parse_range, resolve as resolve_range,
    };
    pub use crate::request::is_fresh;
    pub use crate::static_files::{StaticMount, resolve_for_fuzzing as resolve_static};
    #[cfg(feature = "tls")]
    pub use crate::tls::{ALPN_PROTOCOLS, Loaded as TlsLoaded, build as build_tls};
}

/// The hyper `Service` dispatching requests to the Lua pool.
pub mod service;

pub use config::{
    CacheConfig, CompressionConfig, Config, CookieSecure, CookiesConfig, CorsConfig,
    DatabaseConfig, FetchConfig, HealthConfig, LimitsConfig, LogConfig, LogFormat, LuaConfig,
    MultipartConfig, OpenApiConfig, RateLimitConfig, ShutdownConfig, StaticConfig, StdConfig,
    SwaggerConfig, TlsConfig,
};
pub use server::{Server, ServerBuilder};