cogo_http/header/common/expires.rs
1use crate::header::HttpDate;
2
3header! {
4 /// `Expires` header, defined in [RFC7234](http://tools.ietf.org/html/rfc7234#section-5.3)
5 ///
6 /// The `Expires` header field gives the date/time after which the
7 /// response is considered stale.
8 ///
9 /// The presence of an Expires field does not imply that the original
10 /// resource will change or cease to exist at, before, or after that
11 /// time.
12 ///
13 /// # ABNF
14 /// ```plain
15 /// Expires = HTTP-date
16 /// ```
17 ///
18 /// # Example values
19 /// * `Thu, 01 Dec 1994 16:00:00 GMT`
20 ///
21 /// # Example
22 /// ```
23 /// # extern crate cogo_http;
24 /// # extern crate time;
25 /// # fn main() {
26 /// // extern crate time;
27 ///
28 /// use cogo_http::header::{Headers, Expires, HttpDate};
29 /// use time::{self, Duration};
30 ///
31 /// let mut headers = Headers::new();
32 /// headers.set(Expires(HttpDate(time::now() + Duration::days(1))));
33 /// # }
34 /// ```
35 (Expires, "Expires") => [HttpDate]
36
37 test_expires {
38 // Testcase from RFC
39 test_header!(test1, vec![b"Thu, 01 Dec 1994 16:00:00 GMT"]);
40 }
41}
42
43bench_header!(imf_fixdate, Expires, { vec![b"Sun, 07 Nov 1994 08:48:37 GMT".to_vec()] });
44bench_header!(rfc_850, Expires, { vec![b"Sunday, 06-Nov-94 08:49:37 GMT".to_vec()] });
45bench_header!(asctime, Expires, { vec![b"Sun Nov 6 08:49:37 1994".to_vec()] });