hyper_sync/header/common/last_modified.rs
1use header::HttpDate;
2
3header! {
4 /// `Last-Modified` header, defined in
5 /// [RFC7232](http://tools.ietf.org/html/rfc7232#section-2.2)
6 ///
7 /// The `Last-Modified` header field in a response provides a timestamp
8 /// indicating the date and time at which the origin server believes the
9 /// selected representation was last modified, as determined at the
10 /// conclusion of handling the request.
11 ///
12 /// # ABNF
13 ///
14 /// ```text
15 /// Expires = HTTP-date
16 /// ```
17 ///
18 /// # Example values
19 ///
20 /// * `Sat, 29 Oct 1994 19:43:31 GMT`
21 ///
22 /// # Example
23 ///
24 /// ```
25 /// use hyper_sync::header::{Headers, LastModified};
26 /// use std::time::{SystemTime, Duration};
27 ///
28 /// let mut headers = Headers::new();
29 /// let modified = SystemTime::now() - Duration::from_secs(60 * 60 * 24);
30 /// headers.set(LastModified(modified.into()));
31 /// ```
32 (LastModified, "Last-Modified") => [HttpDate]
33
34 test_last_modified {
35 // Testcase from RFC
36 test_header!(test1, vec![b"Sat, 29 Oct 1994 19:43:31 GMT"]);}
37}
38
39bench_header!(imf_fixdate, LastModified, { vec![b"Sun, 07 Nov 1994 08:48:37 GMT".to_vec()] });
40bench_header!(rfc_850, LastModified, { vec![b"Sunday, 06-Nov-94 08:49:37 GMT".to_vec()] });
41bench_header!(asctime, LastModified, { vec![b"Sun Nov 6 08:49:37 1994".to_vec()] });