-
fix(serve): plumb --user-agent through CDP server (#71) (#76)
发布于
2026-05-03 15:32:38 +00:00 | 1089 次提交 在此版本后已推送到 mainobscura serve --user-agent only logged the value via tracing::info!
and never passed it to the CDP server, so every navigation kept using
the default Chrome UA string and httpbin.org/user-agent reported the
default rather than the override.Plumb the option end-to-end:
- BrowserContext::with_full_options(id, proxy, stealth, user_agent)
initializes both BrowserContext::user_agent and the underlying
ObscuraHttpClient::user_agent RwLock at construction time so the
first navigation already sees the override. - CdpContext::new_with_full_options forwards the UA to the default
BrowserContext. - obscura_cdp::start_with_full_options accepts the UA and passes it
through cdp_processor. - main.rs Serve arm calls start_with_full_options with the parsed UA.
- run_multi_worker_serve forwards --user-agent when spawning
worker subprocesses so multi-worker mode honors the flag too.
Existing two-arg start_with_options and three-arg with_options stay
as thin shims (call the full variant with None) so older callers and
the public crate API remain source-compatible.Three new unit tests in obscura-browser cover the propagation, the
Chrome default fallback, and the legacy with_options path.Generated by Ora Studio
Vibe coded by ousamabenyounesCo-authored-by: Ora Studio noreply@oratelecom.net
下载附件
- BrowserContext::with_full_options(id, proxy, stealth, user_agent)