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-secrets` 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;
22pub mod multipart;
23pub mod netpolicy;
24mod redirect;
25pub mod retry;
26pub mod secret;
27pub mod sse;
28mod system_proxy;
29mod trust;
30#[cfg(feature = "untrusted")]
31pub mod untrusted;
32mod urlredact;
33
34#[cfg(feature = "testing")]
35pub mod testing;
36
37pub use cancel::{is_cancelled_io, CancelToken};
38pub use client::{
39    form_encode, percent_decode, percent_encode, Client, ClientConfig, Method, ProxyDiagnostic,
40    ProxyMode, Request, Response, ResponseHead, RetryEvent, StreamResponse, TrustRoots,
41};
42pub use error::{ErrorClass, HttpError, Phase};
43pub use multipart::Multipart;
44pub use netpolicy::{
45    parse_host_ip, parse_legacy_ipv4, AddressClass, AddressPolicy, HostIpKind, IpNet, ParsedHostIp,
46};
47pub use retry::{parse_retry_after, RetryPolicy};
48pub use secret::{MemorySecretStore, Secret, SecretError, SecretStore};
49pub use sse::{SseDecoder, SseEvent, SseReader};
50#[cfg(feature = "untrusted")]
51pub use untrusted::{
52    wrap_untrusted_web_text, wrap_untrusted_web_text_coderight, wrap_untrusted_web_text_with,
53    WrapOptions,
54};
55
56#[cfg(feature = "async")]
57pub use async_client::{AsyncClient, AsyncStreamResponse, BodyStream, SseStream};