Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

3.7 KB
Raw Blame
//! HTTP transport primitives for Moli.
//!
//! This crate provides fetch configuration, request/response models, async HTTP
//! execution, streaming HTML responses, and cookie-aware helper utilities used
//! by higher-level browser code.

mod auth_retry;
mod blocking;
mod cancellation;
mod client;
mod client_hints;
mod config;
mod cors;
mod dns;
mod error;
mod fetch_url_list;
mod headers;
mod network_fetch_result;
mod proxy;
mod proxy_connect;
mod referrer_policy;
mod request;
mod request_policy;
mod response;
mod runtime;
mod streaming_response;
#[cfg(test)]
mod tests;
mod url_pattern;

pub use auth_retry::AuthRetryBudget;
#[cfg(any(test, feature = "test-support"))]
pub use blocking::{
    StreamingHtmlResponseStart, StreamingResponseCollector, outgoing_request_headers,
};
pub use blocking::{
    clear_http_cache, clear_http_cache_for_origin, clear_http_cache_root,
    clear_http_cache_root_for_origin, cookie_header_for_request, http_cache_stats,
    observe_cookie_access_report_for_request, trim_http_cache,
};
pub use cancellation::{FetchCancelHandle, FetchResponseTiming};
pub use client::{FetchClient, FetchClientHandle};
pub use config::FetchConfig;
pub use cors::validate_cors_response_for_origin;
pub use error::{
    FetchCancelled, NET_ERR_ABORTED_ERROR_TEXT, ensure_http_status_success, is_fetch_cancelled,
};
pub use fetch_url_list::FetchUrlList;
pub use headers::{
    cors_unsafe_request_header_names, is_cors_safelisted_method,
    is_cors_safelisted_request_content_type, is_cors_safelisted_request_header,
    is_cors_safelisted_request_range, is_cors_unsafe_request_header_byte,
    is_forbidden_request_header_name, is_forbidden_request_header_override_value,
    is_forbidden_response_header_name, is_no_cors_safelisted_request_header,
    split_http_header_list,
};
pub use moli_cookie_jar::SharedBrowserCookieStore as SharedCookieStore;
pub use moli_curl::websocket::CurlWebSocketConnector;
pub use moli_curl::{CurlTlsConfig, validate_http_host_resolve_entries};
pub use moli_header_field::HeaderFields as RequestHeaders;
pub use moli_header_field::HeaderFields as ResponseHeaders;
pub use moli_header_field::{
    decode_header_value, deserialize_headers, header_value_from_byte_string,
    headers_from_byte_strings, headers_to_byte_strings,
};
pub use moli_web_bot_auth::{WebBotAuthProfile, WebBotAuthSigner};
pub use network_fetch_result::{
    NetworkExchangeObservation, NetworkFetchFailureContext, NetworkFetchFailureRequestContext,
    NetworkFetchResult, NetworkObservationJournal, NetworkRequestObservation,
    NetworkResponseObservation,
};
pub use referrer_policy::{
    DEFAULT_REFERRER_POLICY, effective_referrer_policy, normalize_referrer_policy,
    origin_referrer_url, referrer_header_value, referrer_value,
    response_referrer_policy_from_headers, sanitized_referrer_url,
};
pub use request::{
    BrowserNavigationRequestKind, BrowserRequestMetadata, FetchPriorityHint, Request, RequestAuth,
    RequestAuthScheme, RequestAuthTarget, RequestCacheMode, RequestCredentialsMode,
    RequestHeaderOverride, RequestMode, RequestPriorityHints, RequestRedirectHandling,
    RequestRedirectMode, RequestResourceType, ResourceLoadPriority, ScriptFetchRequestMetadata,
    ScriptFetchSchedulerPriority, SubresourceRequestMetadata,
};
pub use request_policy::{is_bad_port, should_request_be_blocked_due_to_bad_port};
pub use response::{
    NegotiatedHttpVersion, NetworkRequestExtraInfo, NetworkResponseExtraInfo, RawResponse,
    RedirectInfo, RedirectSource, Response, ResponseBody, ResponseHead,
};
pub use runtime::PendingStreamingRawResponse;
pub use runtime::{
    FetchRuntimeIdentity, FetchRuntimeJoinReport, FetchRuntimeJoinStatus, FetchRuntimePanicReport,
};
pub use streaming_response::{StreamingHtmlResponse, StreamingRawResponse};
pub use url_pattern::url_pattern_matches;