pub struct HandlerConfig {Show 30 fields
pub ignore_https_errors: bool,
pub viewport: Option<Viewport>,
pub context_ids: Vec<BrowserContextId>,
pub request_timeout: Duration,
pub request_intercept: bool,
pub cache_enabled: bool,
pub service_worker_enabled: bool,
pub ignore_visuals: bool,
pub ignore_stylesheets: bool,
pub ignore_javascript: bool,
pub allow_first_party_stylesheets: bool,
pub allow_first_party_javascript: bool,
pub allow_first_party_visuals: bool,
pub ignore_analytics: bool,
pub ignore_prefetch: bool,
pub ignore_ads: bool,
pub extra_headers: Option<HashMap<String, String>>,
pub only_html: bool,
pub created_first_target: bool,
pub intercept_manager: NetworkInterceptManager,
pub max_bytes_allowed: Option<u64>,
pub max_redirects: Option<usize>,
pub max_main_frame_navigations: Option<u32>,
pub whitelist_patterns: Option<Vec<String>>,
pub blacklist_patterns: Option<Vec<String>>,
pub remote_local_policy: bool,
pub channel_capacity: usize,
pub page_channel_capacity: usize,
pub connection_retries: u32,
pub connect_headers: ConnectHeaders,
}Expand description
How to configure the handler
Fields§
§ignore_https_errors: boolWhether the NetworkManagers should ignore https errors
viewport: Option<Viewport>Window and device settings
context_ids: Vec<BrowserContextId>Context ids to set from the get go
request_timeout: Durationdefault request timeout to use
request_intercept: boolWhether to enable request interception
cache_enabled: boolWhether to enable cache
service_worker_enabled: boolWhether to enable Service Workers
ignore_visuals: boolWhether to ignore visuals.
ignore_stylesheets: boolWhether to ignore stylesheets.
ignore_javascript: boolWhether to ignore Javascript only allowing critical framework or lib based rendering.
allow_first_party_stylesheets: boolWhen ignore_stylesheets would skip a stylesheet, allow it through if
the request URL is first-party (registrable domain matches the page’s
primary frame). Default true so SPAs that load their own CSS via
dynamic imports still hydrate. Set false for strict block-all.
allow_first_party_javascript: boolWhen a downstream blocker (intercept manager / adblock / blocklists)
would skip a script, allow it through if first-party. Default true
so SPA bootloaders are not collateral damage from third-party rules.
allow_first_party_visuals: boolWhen ignore_visuals would skip an image/media/font, allow it through
if the request URL is first-party. Default true. Set false for
strict bandwidth-minimal crawls that drop ALL visuals.
ignore_analytics: boolWhether to ignore analytics.
ignore_prefetch: boolIgnore prefetch request. Defaults to true.
ignore_ads: boolWhether to ignore ads.
extra_headers: Option<HashMap<String, String>>Extra headers.
only_html: boolOnly Html.
created_first_target: boolCreated the first target.
intercept_manager: NetworkInterceptManagerThe network intercept manager.
max_bytes_allowed: Option<u64>The max bytes to receive.
max_redirects: Option<usize>Cap on main-frame Document redirect hops (per navigation).
None disables enforcement (default); Some(n) aborts once the chain length
exceeds n by emitting net::ERR_TOO_MANY_REDIRECTS and calling
Page.stopLoading. Preserves the accumulated redirect_chain on the failed
request so consumers can inspect it.
Cap on main-frame cross-document navigations per goto. Defends against
JS / meta-refresh loops that bypass the HTTP redirect guard. None
disables the guard.
whitelist_patterns: Option<Vec<String>>Optional per-run/per-site whitelist of URL substrings (scripts/resources).
blacklist_patterns: Option<Vec<String>>Optional per-run/per-site blacklist of URL substrings (scripts/resources).
remote_local_policy: boolPush the interception policy to a capable remote engine once per
navigation (Interception.setPolicy) so it can resolve block/allow
locally instead of round-tripping each Fetch.requestPaused. Default
false; safe to enable against any target (unknown method is ignored).
channel_capacity: usizeCapacity of the channel between browser handle and handler. Defaults to 1000.
page_channel_capacity: usizeCapacity of the per-page mpsc channel carrying TargetMessages
from each Page to the handler.
Defaults to DEFAULT_PAGE_CHANNEL_CAPACITY (2048) — the previous
hard-coded value. Tune upward for pages that burst many commands
(heavy evaluate/selector use, high-concurrency tasks sharing
one page) to avoid pushing each extra command onto the
CommandFuture async-send fallback path on TrySendError::Full.
Tune downward to apply back-pressure sooner. Values of 0 are
clamped to 1 at channel creation.
connection_retries: u32Number of WebSocket connection retry attempts with exponential backoff. Defaults to 4.
connect_headers: ConnectHeadersHeaders added to the CDP WebSocket upgrade request, so a gateway in
front of the browser can read them off the handshake. Unrelated to
extra_headers, which go on the page’s network requests. Sent on
every connect attempt. Empty by default, which leaves the upgrade
untouched.
Trait Implementations§
Source§impl Clone for HandlerConfig
impl Clone for HandlerConfig
Source§fn clone(&self) -> HandlerConfig
fn clone(&self) -> HandlerConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more