Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add uri typed headers #3455

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

keithamus
Copy link

@keithamus keithamus commented Aug 17, 2024

PR Type

Feature

PR Checklist

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made for the appropriate packages.
  • Format code with the latest stable rustfmt.
  • (Team) Label with affected crates and semver status.

Overview

This adds the Location, Content-Location and Referer typed headers. It also adds the TryIntoHeaderValue trait for Uri which allows Uri to be a typed value for these headers.

While Location technically is a different type than Content-Location and Referer (Location allows for protocol relative URIs) I think it's not a large enough distinction to warrant a separate type, as using protocol relative urls is quite rare. However we could use url::Url instead of Uri for Location if we wanted to allow for that distinction.

The motivation for this PR is to allow for using Referer as an Extractor, and the other two were easy enough to also add, and complete the trifecta of URI related headers (to the best of my knowledge).

@keithamus keithamus force-pushed the add-uri-typed-headers branch 2 times, most recently from c75c46d to 3d17c3f Compare August 17, 2024 22:33
@robjtede robjtede added B-semver-minor A-web project: actix-web labels Aug 19, 2024
actix-http/src/header/into_value.rs Show resolved Hide resolved
actix-web/src/http/header/content_location.rs Outdated Show resolved Hide resolved
actix-web/src/http/header/mod.rs Outdated Show resolved Hide resolved
@keithamus keithamus force-pushed the add-uri-typed-headers branch from 3d17c3f to f96a21f Compare August 19, 2024 13:13
@keithamus keithamus requested a review from robjtede August 19, 2024 13:13
@keithamus
Copy link
Author

@robjtede those changes have been made. Let me know if you have any more feedback.

@keithamus
Copy link
Author

I'm still interested in this patch, if you think it's worth merging in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-web project: actix-web B-semver-minor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants