Files
obscura/crates/obscura-net/src/lib.rs
T
Jim Zhang @ wonderhoi f5dc97b131 fix(net): scope passive callbacks to the registering page (#414)
The on_request/on_response Vec lived on the ObscuraHttpClient shared by
every page in the context, so a callback registered on one page fired for
all pages (#408 cross-page bleed) and outlived its page.

Callbacks now live in a per-page CallbackRegistry (Arc shared with the
page's JS runtime state). Page-driven fetch paths (navigation, POST,
scripts, stylesheets, robots.txt, module loads, JS fetch/XHR in both
plain and stealth modes) pass the registry through; the HTTP client
itself is callback-free.

Adds callbacks_do_not_bleed_across_pages: page A's callback stays silent
for page B's requests and stops firing after page A is dropped.
2026-07-16 12:43:13 +02:00

27 lines
845 B
Rust

pub mod client;
pub mod cookies;
pub mod encoding;
pub mod interceptor;
pub mod robots;
pub mod blocklist;
#[cfg(feature = "stealth")]
pub mod wreq_client;
pub use client::{
env_allows_private_network, is_forbidden_ip, CallbackRegistry, ObscuraHttpClient,
ObscuraNetError, RequestCallback, RequestInfo, ResourceType, Response, ResponseCallback,
SsrfGuardResolver,
};
pub use cookies::{default_cookie_path, CookieInfo, CookieJar};
pub use encoding::{
decode_non_html, decode_response, decode_response_with_name, decode_with_label, label_name,
url_encode_query,
};
pub use robots::RobotsCache;
pub use blocklist::is_blocked as is_tracker_blocked;
#[cfg(feature = "stealth")]
pub use wreq_client::{
StealthHttpClient, STEALTH_NAVIGATOR_PLATFORM, STEALTH_UA_PLATFORM,
STEALTH_UA_PLATFORM_VERSION, STEALTH_USER_AGENT,
};