Skip to content

Expose bounded typed Location metadata on client responses #553

Description

@fewensa

Summary

Response::location() currently returns the first raw header value. Add a bounded, typed Location response-metadata helper so callers can safely inspect redirect targets while retaining the existing raw-header API.

Acceptance criteria

  • Add a public rttp_protocol::location module with a Location value type and parse error type for one Location field value.
  • Accept a non-empty absolute URI or relative URI reference after trimming HTTP optional whitespace; reject control bytes, unsafe field-value characters, malformed percent escapes, and values over 64 KiB.
  • Add Response::location() -> error::Result<Option<Location>>, returning Ok(None) when absent and an error for duplicate Location fields or malformed values. Preserve raw header access through the ordinary response accessors.
  • Re-export the new types through rttp_client::response and the public rttp client facade as appropriate.
  • Add focused protocol and client tests for absolute and relative targets, absent values, duplicate fields, malformed input, and raw-header preservation.
  • Keep the feature metadata-only: do not automatically follow redirects, resolve targets, retry/replay requests, or apply redirect policy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions