-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add uri typed headers #3455
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
Open
keithamus
wants to merge
11
commits into
actix:master
Choose a base branch
from
keithamus:add-uri-typed-headers
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add uri typed headers #3455
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9b6a93d
TryIntoHeaderValue for Uri
keithamus 342242a
add content-location typed header
keithamus f5d3408
add location typed header
keithamus 3ff861e
add referer typed header
keithamus bbb7258
add changelog entry for TryIntoHeaderValue Uri
keithamus b66866d
update references and text to RFC 9110
keithamus f96a21f
make Uri in http::header private
keithamus 4f8819d
use parens to appease linter
keithamus 66873d1
Merge branch 'master' into add-uri-typed-headers
keithamus cfaa5b2
Merge branch 'master' into add-uri-typed-headers
robjtede 98e0cc4
Merge branch 'master' into add-uri-typed-headers
robjtede File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use super::{Uri, CONTENT_LOCATION}; | ||
|
||
crate::http::header::common_header! { | ||
/// `Content-Location` header, defined | ||
/// in [RFC 9110 §8.7](https://datatracker.ietf.org/doc/html/rfc9110#section-8.7) | ||
/// | ||
/// The "Content-Location" header field references a URI that can be used | ||
/// as an identifier for a specific resource corresponding to the | ||
/// representation in this message's content. | ||
/// | ||
/// # ABNF | ||
/// ```plain | ||
/// Content-Location = absolute-URI / partial-URI | ||
/// ``` | ||
/// | ||
/// # Example Values | ||
/// * `http://www.example.org/hypertext/Overview.html` | ||
/// | ||
/// # Examples | ||
/// | ||
/// ``` | ||
/// use actix_web::HttpResponse; | ||
/// use actix_http::Uri; | ||
/// use actix_web::http::header::ContentLocation; | ||
/// | ||
/// let mut builder = HttpResponse::Created(); | ||
/// builder.insert_header( | ||
/// ContentLocation("http://www.example.org".parse::<Uri>().unwrap()) | ||
/// ); | ||
/// ``` | ||
(ContentLocation, CONTENT_LOCATION) => [Uri] | ||
|
||
test_parse_and_format { | ||
crate::http::header::common_header_test!(test1, [b"http://www.example.org/hypertext/Overview.html"]); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use super::{Uri, LOCATION}; | ||
|
||
crate::http::header::common_header! { | ||
/// `Location` header, defined | ||
/// in [RFC 9110 §10.2.2](https://datatracker.ietf.org/doc/html/rfc9110#section-10.2.2) | ||
/// | ||
/// The "Location" header field is used in some responses to refer to a | ||
/// specific resource in relation to the response. The type of relationship | ||
/// is defined by the combination of request method and status code | ||
/// semantics. | ||
/// | ||
/// # ABNF | ||
/// ```plain | ||
/// Location = URI-reference | ||
/// ``` | ||
/// | ||
/// # Example Values | ||
/// * `http://www.example.org/hypertext/Overview.html` | ||
/// | ||
/// # Examples | ||
/// | ||
/// ``` | ||
/// use actix_web::HttpResponse; | ||
/// use actix_http::Uri; | ||
/// use actix_web::http::header::Location; | ||
/// | ||
/// let mut builder = HttpResponse::Ok(); | ||
/// builder.insert_header( | ||
/// Location("http://www.example.org".parse::<Uri>().unwrap()) | ||
/// ); | ||
/// ``` | ||
(Location, LOCATION) => [Uri] | ||
|
||
test_parse_and_format { | ||
crate::http::header::common_header_test!(test1, [b"http://www.example.org/hypertext/Overview.html"]); | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use super::{Uri, REFERER}; | ||
|
||
crate::http::header::common_header! { | ||
/// `Referer` header, defined | ||
/// in [RFC 9110 §10.1.3](https://datatracker.ietf.org/doc/html/rfc9110#section-10.1.3) | ||
/// | ||
/// The "Referer" (sic) header field allows the user agent to specify a URI | ||
/// reference for the resource from which the target URI was obtained (i.e., | ||
/// the "referrer", though the field name is misspelled). | ||
/// | ||
/// # ABNF | ||
/// ```plain | ||
/// Referer = absolute-URI / partial-URI | ||
/// ``` | ||
/// | ||
/// # Example Values | ||
/// * `http://www.example.org/hypertext/Overview.html` | ||
/// | ||
/// # Examples | ||
/// | ||
/// ``` | ||
/// use actix_web::HttpResponse; | ||
/// use actix_http::Uri; | ||
/// use actix_web::http::header::Referer; | ||
/// | ||
/// let mut builder = HttpResponse::Ok(); | ||
/// builder.insert_header( | ||
/// Referer("http://www.example.org".parse::<Uri>().unwrap()) | ||
/// ); | ||
/// ``` | ||
(Referer, REFERER) => [Uri] | ||
|
||
test_parse_and_format { | ||
crate::http::header::common_header_test!(test1, [b"http://www.example.org/hypertext/Overview.html"]); | ||
} | ||
} |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.