hyper_sync/header/common/expires.rs
1use 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 ///
15 /// ```text
16 /// Expires = HTTP-date
17 /// ```
18 ///
19 /// # Example values
20 /// * `Thu, 01 Dec 1994 16:00:00 GMT`
21 ///
22 /// # Example
23 ///
24 /// ```
25 /// use hyper_sync::header::{Headers, Expires};
26 /// use std::time::{SystemTime, Duration};
27 ///
28 /// let mut headers = Headers::new();
29 /// let expiration = SystemTime::now() + Duration::from_secs(60 * 60 * 24);
30 /// headers.set(Expires(expiration.into()));
31 /// ```
32 (Expires, "Expires") => [HttpDate]
33
34 test_expires {
35 // Testcase from RFC
36 test_header!(test1, vec![b"Thu, 01 Dec 1994 16:00:00 GMT"]);
37 }
38}
39
40bench_header!(imf_fixdate, Expires, { vec![b"Sun, 07 Nov 1994 08:48:37 GMT".to_vec()] });
41bench_header!(rfc_850, Expires, { vec![b"Sunday, 06-Nov-94 08:49:37 GMT".to_vec()] });
42bench_header!(asctime, Expires, { vec![b"Sun Nov 6 08:49:37 1994".to_vec()] });