Add typed User-Agent server request accessors - #923
Merged
Conversation
codeon:
version: 1
authority: FWN-326
description: |-
Expose Request::user_agent and HttpRequest::user_agent through the shared rttp-protocol User-Agent primitive. Absent fields return Ok(None); duplicate field lines, malformed products or comments, forbidden controls, and bound violations return the typed parse error without flattening. Re-export HttpUserAgent aliases, document syntax-only metadata in the server README, and add HTTP/1.1 plus HTTP/2 tests that preserve raw headers after typed parse failures.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Expose typed User-Agent accessors on Request and HttpRequest by consuming rttp-protocol::user_agent.
Request::user_agent() and HttpRequest::user_agent() return Ok(None) when the field is absent, parse a singleton field through parse_values, and reject duplicate field lines, malformed products or comments, forbidden controls, and bound violations without flattening. Raw header() access is unchanged after typed parse errors. HttpUserAgent, HttpUserAgentMember, and HttpUserAgentParseError are re-exported beside neighboring request metadata aliases. The server README documents this as syntax-only metadata and does not use User-Agent for routing, authentication, logging, fingerprinting, or request acceptance.
Focused HTTP/1.1 and HTTP/2 tests cover valid, absent, duplicate, malformed, bound, and raw-header preservation cases. cargo fmt --all -- --check, cargo clippy --workspace --all-targets --all-features -- -D warnings, and cargo test --all-features passed.