Files
hyper/src/header/common/transfer_encoding.rs
Sean McArthur d35992d019 feat(lib): switch to non-blocking (asynchronous) IO
BREAKING CHANGE: This breaks a lot of the Client and Server APIs.
  Check the documentation for how Handlers can be used for asynchronous
  events.
2016-05-16 09:51:18 -07:00

61 lines
1.7 KiB
Rust

use header::Encoding;
header! {
/// `Transfer-Encoding` header, defined in
/// [RFC7230](http://tools.ietf.org/html/rfc7230#section-3.3.1)
///
/// The `Transfer-Encoding` header field lists the transfer coding names
/// corresponding to the sequence of transfer codings that have been (or
/// will be) applied to the payload body in order to form the message
/// body.
///
/// # ABNF
/// ```plain
/// Transfer-Encoding = 1#transfer-coding
/// ```
///
/// # Example values
/// * `gzip, chunked`
///
/// # Example
/// ```
/// use hyper::header::{Headers, TransferEncoding, Encoding};
///
/// let mut headers = Headers::new();
/// headers.set(
/// TransferEncoding(vec![
/// Encoding::Gzip,
/// Encoding::Chunked,
/// ])
/// );
/// ```
(TransferEncoding, "Transfer-Encoding") => (Encoding)+
transfer_encoding {
test_header!(
test1,
vec![b"gzip, chunked"],
Some(HeaderField(
vec![Encoding::Gzip, Encoding::Chunked]
)));
// Issue: #683
test_header!(
test2,
vec![b"chunked", b"chunked"],
Some(HeaderField(
vec![Encoding::Chunked, Encoding::Chunked]
)));
}
}
impl TransferEncoding {
/// Constructor for the most common Transfer-Encoding, `chunked`.
pub fn chunked() -> TransferEncoding {
TransferEncoding(vec![Encoding::Chunked])
}
}
bench_header!(normal, TransferEncoding, { vec![b"chunked, gzip".to_vec()] });
bench_header!(ext, TransferEncoding, { vec![b"ext".to_vec()] });