Skip to content

feat: add --user-agent flag for full User-Agent override#2035

Open
tmchow wants to merge 1 commit intolightpanda-io:mainfrom
tmchow:osc/2029-user-agent-override
Open

feat: add --user-agent flag for full User-Agent override#2035
tmchow wants to merge 1 commit intolightpanda-io:mainfrom
tmchow:osc/2029-user-agent-override

Conversation

@tmchow
Copy link
Copy Markdown
Contributor

@tmchow tmchow commented Mar 30, 2026

Adds a --user-agent CLI flag that replaces the entire User-Agent header. When set, the provided string is used as-is instead of the default Lightpanda/1.0 prefix.

This addresses users migrating from Chrome headless who need full UA control. The existing --user-agent-suffix behavior is unchanged.

The change is in Config.zig:

  • New user_agent field in Common options
  • New userAgent() accessor (same pattern as userAgentSuffix())
  • HttpHeaders.init checks userAgent() first, falls back to suffix, then default
  • Arg parser handles --user-agent / --user_agent

The CDP Emulation.setUserAgentOverride command is still stubbed. Wiring a runtime UA override through the CDP session to the HTTP layer is a larger change that could follow separately.

This contribution was developed with AI assistance (Claude Code).

Fixes #2029

@tmchow tmchow mentioned this pull request Mar 30, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 30, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@tmchow
Copy link
Copy Markdown
Contributor Author

tmchow commented Mar 30, 2026

I have read the CLA Document and I hereby sign the CLA

@tmchow
Copy link
Copy Markdown
Contributor Author

tmchow commented Mar 30, 2026

recheck

When --user-agent is set, the provided string replaces the entire
User-Agent header instead of appending to "Lightpanda/1.0".
The existing --user-agent-suffix behavior is unchanged.

Fixes lightpanda-io#2029
@tmchow tmchow force-pushed the osc/2029-user-agent-override branch from 6360383 to 89aa3ba Compare April 3, 2026 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modify User Agent

1 participant