cogo_http/header/common/
last_modified.rs

1use crate::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    /// ```plain
14    /// Expires = HTTP-date
15    /// ```
16    /// 
17    /// # Example values
18    /// * `Sat, 29 Oct 1994 19:43:31 GMT`
19    /// 
20    /// # Example
21    /// ```
22    /// # extern crate cogo_http;
23    /// # extern crate time;
24    /// # fn main() {
25    /// // extern crate time;
26    /// 
27    /// use cogo_http::header::{Headers, LastModified, HttpDate};
28    /// use time::{self, Duration};
29    /// 
30    /// let mut headers = Headers::new();
31    /// headers.set(LastModified(HttpDate(time::now() - Duration::days(1))));
32    /// # }
33    /// ```
34    (LastModified, "Last-Modified") => [HttpDate]
35
36    test_last_modified {
37        // Testcase from RFC
38        test_header!(test1, vec![b"Sat, 29 Oct 1994 19:43:31 GMT"]);}
39}
40
41bench_header!(imf_fixdate, LastModified, { vec![b"Sun, 07 Nov 1994 08:48:37 GMT".to_vec()] });
42bench_header!(rfc_850, LastModified, { vec![b"Sunday, 06-Nov-94 08:49:37 GMT".to_vec()] });
43bench_header!(asctime, LastModified, { vec![b"Sun Nov  6 08:49:37 1994".to_vec()] });