Skip to main content

eggfetch_core/
lib.rs

1//! Async-first HTTP client engine for eggfetch.
2//!
3//! This crate is the single owner of HTTP behavior. The CLI and Python
4//! bindings are thin adapters that delegate to it.
5//!
6//! # Example
7//!
8//! ```no_run
9//! # async fn example() -> eggfetch_core::Result<()> {
10//! use eggfetch_core::Client;
11//!
12//! let client = Client::new();
13//! let mut response = client
14//!     .get("https://example.com")?
15//!     .header("user-agent", "eggfetch")
16//!     .query("q", "test")
17//!     .send()
18//!     .await?;
19//!
20//! assert!(response.status().is_success());
21//! let bytes = response.bytes().await?;
22//! # Ok(())
23//! # }
24//! ```
25
26#![deny(missing_docs)]
27
28pub mod auth;
29pub mod body;
30pub mod client;
31pub mod compression;
32#[cfg(feature = "cookies")]
33pub mod cookie;
34pub mod error;
35mod h2_headers;
36pub mod headers;
37pub(crate) mod http_origin;
38pub mod http_version;
39pub mod limits;
40#[cfg(feature = "multipart")]
41pub mod multipart;
42pub mod network_stream;
43pub(crate) mod pipeline;
44pub mod pool;
45#[cfg(feature = "proxy")]
46pub mod proxy;
47pub mod redact;
48#[cfg(feature = "redirects")]
49pub mod redirect;
50#[cfg(feature = "high-level-url")]
51pub mod request;
52#[cfg(feature = "high-level-url")]
53pub mod response;
54#[cfg(feature = "high-level-url")]
55pub(crate) mod response_decode;
56#[cfg(feature = "logical-retry")]
57pub mod retry;
58pub mod service;
59pub(crate) mod stream;
60pub mod timeout;
61#[cfg(feature = "tls-rustls")]
62pub mod tls;
63pub mod trace;
64pub mod transport;
65pub mod transport_hints;
66
67#[cfg(feature = "basic-auth")]
68pub use auth::BasicAuth;
69pub use auth::{AuthScheme, BearerAuth};
70pub use body::{BoxBytesStream, NativeResponseBody, RequestBody, ResponseBody, SharedTrailers};
71pub use client::{Client, ClientBuilder};
72pub use compression::{accept_encoding_value, ContentCoding};
73pub use error::{Error, NetworkFailureKind, RequestFailure, Result, TransportFailureKind};
74pub use headers::Headers;
75pub use http::Method;
76pub use http_version::HttpVersionPolicy;
77pub use limits::Limits;
78#[cfg(feature = "multipart")]
79pub use multipart::{Boundary, Multipart, MultipartEncoder, Part, PartBody};
80pub use network_stream::{
81    ConnectionMetadata, ExtraInfo, NetworkStream, TlsInfo, TransportKind, UpgradedStream,
82    UpgradedStreamVariant,
83};
84pub use pool::{Pool, PoolConfig};
85#[cfg(feature = "proxy")]
86pub use proxy::{
87    NoProxy, NoProxyRule, Proxy, ProxyAuth, ProxyConfig, ProxyDecision, ProxyEnvironment, ProxyRule,
88};
89pub use redact::{is_sensitive_header, redact_headers, SENSITIVE_HEADERS};
90#[cfg(feature = "high-level-url")]
91pub use redact::{redact_url, redact_url_string};
92#[cfg(all(feature = "high-level-url", feature = "redirects"))]
93pub use redirect::{
94    build_redirect_request_with_redirect_policy, check_https_downgrade, is_https_downgrade,
95};
96#[cfg(feature = "redirects")]
97pub use redirect::{RedirectDowngradePolicy, RedirectPolicy};
98#[cfg(feature = "high-level-url")]
99pub use request::{ProxyOverride, Request, RequestBuilder};
100#[cfg(feature = "high-level-url")]
101pub use response::{HistoryEntry, Response};
102#[cfg(feature = "logical-retry")]
103pub use retry::{
104    BackoffPolicy, MethodPolicy, ReplayCheck, RetryCause, RetryContext, RetryPolicy,
105    RetryPolicyBuilder, StatusPolicy,
106};
107pub use service::NativeHttpService;
108pub use timeout::{Timeout, TimeoutBuilder, TimeoutPhase};
109#[cfg(feature = "tls-rustls")]
110pub use tls::{ClientIdentity, TlsConfig, TlsConfigBuilder, TlsVersion, TrustStore};
111/// Caller-owned fixed-target datagram routing for experimental HTTP/3.
112#[cfg(feature = "http3")]
113pub use transport::datagram::{
114    DatagramDialFuture, DatagramDialer, DatagramRecvFuture, DatagramRoute, DatagramSendFuture,
115};
116#[cfg(feature = "advanced-routing")]
117pub use transport::dialer::{DialError, DialErrorKind, DialFuture, DialStream, DialTarget, Dialer};
118/// Socket option for direct TCP connections (advanced-routing only).
119#[cfg(feature = "advanced-routing")]
120pub use transport::direct_connector::{SocketOption, SocketOptionKind};
121pub use transport::lifecycle::{
122    PhysicalConnectionPolicy, TransportIoDirection, TransportIoTimeout,
123};
124#[cfg(feature = "http3")]
125pub use transport::metrics::{H3CloseKind, H3CloseSummary, H3ConnectionDiagnostic, H3RouteKind};
126pub use transport::metrics::{TransportMetrics, TransportSnapshot};
127pub use transport_hints::{NativeRequestOptions, ResolvedTarget, TransportHints};