Implemented a typed Authorization header

An Authorization header contains a Scheme. If you have no real scheme,
you can use String as your scheme (Authorization<String>).

This includes the `Basic` scheme built-in.
This commit is contained in:
Gilman Tolle
2014-10-15 23:19:22 -07:00
committed by Sean McArthur
parent 7478f3dfd6
commit 91a8e03e7a
4 changed files with 188 additions and 4 deletions

View File

@@ -7,6 +7,7 @@
//! is used, such as `ContentType(pub Mime)`.
pub use self::accept::Accept;
pub use self::authorization::Authorization;
pub use self::connection::Connection;
pub use self::content_length::ContentLength;
pub use self::content_type::ContentType;
@@ -56,8 +57,8 @@ pub mod user_agent;
/// Exposes the Location header.
pub mod location;
pub mod util;
/// Exposes the Authorization header.
pub mod authorization;
fn from_comma_delimited<T: FromStr>(raw: &[Vec<u8>]) -> Option<Vec<T>> {
if raw.len() != 1 {
@@ -85,3 +86,4 @@ fn fmt_comma_delimited<T: Show>(fmt: &mut fmt::Formatter, parts: &[T]) -> fmt::R
}
Ok(())
}
pub mod util;