Debian Codegraph @

third_party/rust/headers/src/common/te.rs

raw
1 use util::FlatCsv;
2
3 /// `TE` header, defined in
4 /// [RFC7230](http://tools.ietf.org/html/rfc7230#section-4.3)
5 ///
6 /// As RFC7230 states, "The "TE" header field in a request indicates what transfer codings,
7 /// besides chunked, the client is willing to accept in response, and
8 /// whether or not the client is willing to accept trailer fields in a
9 /// chunked transfer coding."
10 ///
11 /// For HTTP/1.1 compliant clients `chunked` transfer codings are assumed to be acceptable and
12 /// so should never appear in this header.
13 ///
14 /// # ABNF
15 ///
16 /// ```text
17 /// TE = "TE" ":" #( t-codings )
18 /// t-codings = "trailers" | ( transfer-extension [ accept-params ] )
19 /// ```
20 ///
21 /// # Example values
22 /// * `trailers`
23 /// * `trailers, deflate;q=0.5`
24 /// * ``
25 ///
26 /// # Examples
27 ///
28 #[derive(Clone, Debug, PartialEq)]
29 pub struct Te(FlatCsv);
30
31 derive_header! {
32 Te(_),
33 name: TE
34 }
35
36 impl Te {
37 /// Create a `TE: trailers` header.
38 pub fn trailers() -> Self {
39 Te(::HeaderValue::from_static("trailers").into())
40 }
41 }