From 2983e8dea21f02a31012a25b0a302a128768030a Mon Sep 17 00:00:00 2001 From: Matt McCoy Date: Tue, 24 Mar 2015 21:39:50 -0400 Subject: [PATCH] feat(headers): Implementing content-encoding header Closes #391 --- src/header/common/content_encoding.rs | 19 +++++++++++++++++++ src/header/common/mod.rs | 2 ++ 2 files changed, 21 insertions(+) create mode 100644 src/header/common/content_encoding.rs diff --git a/src/header/common/content_encoding.rs b/src/header/common/content_encoding.rs new file mode 100644 index 00000000..6e56c388 --- /dev/null +++ b/src/header/common/content_encoding.rs @@ -0,0 +1,19 @@ +use header::Encoding; + +/// The `Content-Encoding` header. +/// +/// This header describes the encoding of the message body. It can be +/// comma-separated, including multiple encodings. +/// +/// ```notrust +/// Content-Encoding: gzip +/// ``` +#[derive(Clone, PartialEq, Debug)] +pub struct ContentEncoding(pub Vec); + +impl_list_header!(ContentEncoding, + "Content-Encoding", + Vec); + +bench_header!(single, ContentEncoding, { vec![b"gzip".to_vec()] }); +bench_header!(multiple, ContentEncoding, { vec![b"gzip, deflate".to_vec()] }); diff --git a/src/header/common/mod.rs b/src/header/common/mod.rs index e0a423e3..7a374b8d 100644 --- a/src/header/common/mod.rs +++ b/src/header/common/mod.rs @@ -16,6 +16,7 @@ pub use self::authorization::{Authorization, Scheme, Basic}; pub use self::cache_control::{CacheControl, CacheDirective}; pub use self::connection::{Connection, ConnectionOption}; pub use self::content_length::ContentLength; +pub use self::content_encoding::ContentEncoding; pub use self::content_type::ContentType; pub use self::cookie::Cookie; pub use self::date::Date; @@ -157,6 +158,7 @@ mod authorization; mod cache_control; mod cookie; mod connection; +mod content_encoding; mod content_length; mod content_type; mod date;