hyperx/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 /// # extern crate http;
26 /// use hyperx::header::{Expires, TypedHeaders};
27 /// use std::time::{SystemTime, Duration};
28 ///
29 /// let mut headers = http::HeaderMap::new();
30 /// let expiration = SystemTime::now() + Duration::from_secs(60 * 60 * 24);
31 /// headers.encode(&Expires(expiration.into()));
32 /// ```
33 (Expires, "Expires") => [HttpDate]
34
35 test_expires {
36 // Testcase from RFC
37 test_header!(test1, vec![b"Thu, 01 Dec 1994 16:00:00 GMT"]);
38 }
39}
40
41bench_header!(imf_fixdate, Expires, { vec![b"Mon, 07 Nov 1994 08:48:37 GMT".to_vec()] });
42bench_header!(rfc_850, Expires, { vec![b"Sunday, 06-Nov-94 08:49:37 GMT".to_vec()] });
43bench_header!(asctime, Expires, { vec![b"Sun Nov 6 08:49:37 1994".to_vec()] });
44
45standard_header!(Expires, EXPIRES);