Skip to content

Commit e63a2df

Browse files
committed
Merge pull request #398 from mattnenterprise/content-encoding-header
Implement Content-Encoding Header
2 parents a7e2121 + 2983e8d commit e63a2df

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/header/common/content_encoding.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
use header::Encoding;
2+
3+
/// The `Content-Encoding` header.
4+
///
5+
/// This header describes the encoding of the message body. It can be
6+
/// comma-separated, including multiple encodings.
7+
///
8+
/// ```notrust
9+
/// Content-Encoding: gzip
10+
/// ```
11+
#[derive(Clone, PartialEq, Debug)]
12+
pub struct ContentEncoding(pub Vec<Encoding>);
13+
14+
impl_list_header!(ContentEncoding,
15+
"Content-Encoding",
16+
Vec<Encoding>);
17+
18+
bench_header!(single, ContentEncoding, { vec![b"gzip".to_vec()] });
19+
bench_header!(multiple, ContentEncoding, { vec![b"gzip, deflate".to_vec()] });

src/header/common/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub use self::authorization::{Authorization, Scheme, Basic};
1616
pub use self::cache_control::{CacheControl, CacheDirective};
1717
pub use self::connection::{Connection, ConnectionOption};
1818
pub use self::content_length::ContentLength;
19+
pub use self::content_encoding::ContentEncoding;
1920
pub use self::content_type::ContentType;
2021
pub use self::cookie::Cookie;
2122
pub use self::date::Date;
@@ -157,6 +158,7 @@ mod authorization;
157158
mod cache_control;
158159
mod cookie;
159160
mod connection;
161+
mod content_encoding;
160162
mod content_length;
161163
mod content_type;
162164
mod date;

0 commit comments

Comments
 (0)