File tree 3 files changed +39
-0
lines changed
3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 4
4
5
5
- Add ` http::header::ContentLocation ` typed header.
6
6
- Add ` http::header::Location ` typed header.
7
+ - Add ` http::header::Referer ` typed header.
7
8
8
9
## 4.9.0
9
10
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ mod location;
44
44
mod macros;
45
45
mod preference;
46
46
mod range;
47
+ mod referer;
47
48
48
49
#[ cfg( test) ]
49
50
pub ( crate ) use self :: macros:: common_header_test;
@@ -75,6 +76,7 @@ pub use self::{
75
76
location:: Location ,
76
77
preference:: Preference ,
77
78
range:: { ByteRangeSpec , Range } ,
79
+ referer:: Referer ,
78
80
} ;
79
81
80
82
/// Format writer ([`fmt::Write`]) for a [`BytesMut`].
Original file line number Diff line number Diff line change
1
+ use super :: { Uri , REFERER } ;
2
+
3
+ crate :: http:: header:: common_header! {
4
+ /// `Referer` header, defined
5
+ /// in [RFC 7231 §5.5.2](https://datatracker.ietf.org/doc/html/rfc7231#section-5.5.2)
6
+ ///
7
+ /// The "Referer" [sic] header field allows the user agent to specify a
8
+ /// URI reference for the resource from which the target URI was obtained
9
+ /// (i.e., the "referrer", though the field name is misspelled).
10
+ ///
11
+ /// # ABNF
12
+ /// ```plain
13
+ /// Referer = absolute-URI / partial-URI
14
+ /// ```
15
+ ///
16
+ /// # Example Values
17
+ /// * `http://www.example.org/hypertext/Overview.html`
18
+ ///
19
+ /// # Examples
20
+ ///
21
+ /// ```
22
+ /// use actix_web::HttpResponse;
23
+ /// use actix_http::Uri;
24
+ /// use actix_web::http::header::Referer;
25
+ ///
26
+ /// let mut builder = HttpResponse::Ok();
27
+ /// builder.insert_header(
28
+ /// Referer("http://www.example.org".parse::<Uri>().unwrap())
29
+ /// );
30
+ /// ```
31
+ ( Referer , REFERER ) => [ Uri ]
32
+
33
+ test_parse_and_format {
34
+ crate :: http:: header:: common_header_test!( test1, [ b"http://www.example.org/hypertext/Overview.html" ] ) ;
35
+ }
36
+ }
You can’t perform that action at this time.
0 commit comments