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

@@ -9,7 +9,7 @@ pub fn from_one_raw_str<T: FromStr>(raw: &[Vec<u8>]) -> Option<T> {
return None;
}
// we JUST checked that raw.len() == 1, so raw[0] WILL exist.
match from_utf8(unsafe { raw.as_slice().unsafe_get(0).as_slice() }) {
match from_utf8(unsafe { raw[].unsafe_get(0)[] }) {
Some(s) => FromStr::from_str(s),
None => None
}