Skip to main content

rightkit_http/
lib.rs

1//! `rightkit-http`: the shared blocking HTTP client for Right Suite apps.
2//!
3//! - [`Client`]: timeouts, bounded bodies, retry/backoff honoring `Retry-After`,
4//!   retry-safety rules for non-idempotent methods, streaming responses.
5//! - [`Multipart`]: `multipart/form-data` bodies with exact framing.
6//! - [`netpolicy`]: the outbound address policy (SSRF guard) every request passes: resolve once,
7//!   classify every address, connect only to checked addresses, on every redirect hop.
8//! - [`CancelToken`]: cooperative cancellation for calls and streams.
9//! - [`sse`]: WHATWG-compliant Server-Sent Events decoding.
10//! - `untrusted` (feature, off by default): tamper-evident wrapping of external text for model input.
11//! - [`secret`]: redacted [`Secret`] and the [`SecretStore`] interface that
12//!   `rightkit-credentials` implements.
13//! - `async_client` (feature `async`): [`AsyncClient`], the same policy layer on
14//!   reqwest/tokio, with a body [`BodyStream`] and an async [`SseStream`].
15//! - `testing` (feature): in-process mock server that records exact requests.
16
17#[cfg(feature = "async")]
18pub mod async_client;
19pub mod cancel;
20pub mod client;
21pub mod error;
22mod idle;
23pub mod multipart;
24pub mod netpolicy;
25pub mod quota;
26mod redirect;
27pub mod retry;
28pub mod secret;
29pub mod sse;
30mod system_proxy;
31mod trust;
32#[cfg(feature = "untrusted")]
33pub mod untrusted;
34mod urlredact;
35
36#[cfg(feature = "testing")]
37pub mod testing;
38
39pub use cancel::{is_cancelled_io, CancelToken};
40pub use client::{
41    form_encode, percent_decode, percent_decode_component, percent_encode,
42    percent_encode_component, AttemptDelivery, AttemptEvent, AttemptOutcome, Client, ClientConfig,
43    Method, ProxyDiagnostic, ProxyMode, ProxyModeUsed, Request, Response, ResponseHead, RetryEvent,
44    StreamResponse, TrustRoots,
45};
46pub use error::{ErrorClass, HttpError, Phase};
47pub use multipart::{Multipart, MultipartRelated};
48pub use netpolicy::{
49    parse_host_ip, parse_legacy_ipv4, validate_public_https_url, AddressClass, AddressPolicy,
50    CredentialScope, HostIpKind, IpNet, ParsedHostIp, ResolveError, UrlPolicyError,
51};
52pub use quota::{defer_in, remaining_in, QuotaSchedule, QuotaStore};
53pub use retry::{
54    parse_rate_limit_reset, parse_rate_limit_reset_at, parse_retry_after, parse_retry_after_at,
55    RetryPolicy,
56};
57pub use secret::{MemorySecretStore, Secret, SecretError, SecretStore};
58pub use sse::{EofPolicy, SseDecoder, SseEvent, SseReader};
59#[cfg(feature = "untrusted")]
60pub use untrusted::{
61    wrap_untrusted_web_text, wrap_untrusted_web_text_coderight, wrap_untrusted_web_text_with,
62    WrapOptions,
63};
64
65#[cfg(feature = "async")]
66pub use async_client::{AsyncClient, AsyncStreamResponse, BodyStream, SseStream};