Revert "Added AccessControl* family of headers."
This reverts commit 568707c491.
			
			
This commit is contained in:
		| @@ -1,25 +0,0 @@ | |||||||
| use std::fmt::{mod}; |  | ||||||
|  |  | ||||||
| use header; |  | ||||||
| use header::shared; |  | ||||||
|  |  | ||||||
| #[deriving(Clone)] |  | ||||||
| struct AccessControlAllowHeaders(pub Vec<String>); |  | ||||||
|  |  | ||||||
| impl header::Header for AccessControlAllowHeaders { |  | ||||||
|     #[inline] |  | ||||||
|     fn header_name(_: Option<AccessControlAllowHeaders>) -> &'static str { |  | ||||||
|         "Access-Control-Allow-Headers" |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     fn parse_header(raw: &[Vec<u8>]) -> Option<AccessControlAllowHeaders> { |  | ||||||
|         shared::from_comma_delimited(raw).map(AccessControlAllowHeaders) |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| impl header::HeaderFormat for AccessControlAllowHeaders { |  | ||||||
|     fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { |  | ||||||
|         let AccessControlAllowHeaders(ref parts) = *self; |  | ||||||
|         shared::fmt_comma_delimited(f, parts.as_slice()) |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,25 +0,0 @@ | |||||||
| use std::fmt::{mod}; |  | ||||||
|  |  | ||||||
| use header; |  | ||||||
| use header::shared; |  | ||||||
|  |  | ||||||
| #[deriving(Clone)] |  | ||||||
| struct AccessControlAllowMethods(pub Vec<Method>); |  | ||||||
|  |  | ||||||
| impl header::Header for AccessControlAllowMethods { |  | ||||||
|     #[inline] |  | ||||||
|     fn header_name(_: Option<AccessControlAllowMethods>) -> &'static str { |  | ||||||
|         "Access-Control-Allow-Methods" |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     fn parse_header(raw: &[Vec<u8>]) -> Option<AccessControlAllowMethods> { |  | ||||||
|         shared::from_comma_delimited(raw).map(AccessControlAllowMethods) |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| impl header::HeaderFormat for AccessControlAllowMethods { |  | ||||||
|     fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { |  | ||||||
|         let AccessControlAllowMethods(ref parts) = *self; |  | ||||||
|         shared::fmt_comma_delimited(f, parts.as_slice()) |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,37 +0,0 @@ | |||||||
| use header::shared; |  | ||||||
|  |  | ||||||
| #[deriving(Clone)] |  | ||||||
| enum AccessControlAllowOrigin { |  | ||||||
|     AllowStar, |  | ||||||
|     AllowOrigin(Url), |  | ||||||
| } |  | ||||||
|  |  | ||||||
| impl header::Header for AccessControlAllowOrigin { |  | ||||||
|     #[inline] |  | ||||||
|     fn header_name(_: Option<AccessControlAllowOrigin>) -> &'static str { |  | ||||||
|         "Access-Control-Allow-Origin" |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     fn parse_header(raw: &[Vec<u8>]) -> Option<AccessControlAllowOrigin> { |  | ||||||
|         if raw.len() == 1 { |  | ||||||
|             from_utf8(raw[0].as_slice()).and_then(|s| { |  | ||||||
|                 if s == "*" { |  | ||||||
|                     Some(AllowStar) |  | ||||||
|                 } else { |  | ||||||
|                     Url::parse(s).ok().map(|url| AllowOrigin(url)) |  | ||||||
|                 } |  | ||||||
|             }) |  | ||||||
|         } else { |  | ||||||
|             None |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| impl header::HeaderFormat for AccessControlAllowOrigin { |  | ||||||
|     fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { |  | ||||||
|         match *self { |  | ||||||
|             AllowStar => "*".fmt(f), |  | ||||||
|             AllowOrigin(ref url) => url.fmt(f) |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,23 +0,0 @@ | |||||||
| use header; |  | ||||||
| use header::shared; |  | ||||||
|  |  | ||||||
| #[deriving(Clone)] |  | ||||||
| struct AccessControlMaxAge(pub u32); |  | ||||||
|  |  | ||||||
| impl header::Header for AccessControlMaxAge { |  | ||||||
|     #[inline] |  | ||||||
|     fn header_name(_: Option<AccessControlMaxAge>) -> &'static str { |  | ||||||
|         "Access-Control-Max-Age" |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     fn parse_header(raw: &[Vec<u8>]) -> Option<AccessControlMaxAge> { |  | ||||||
|         shared::from_one_raw_str(raw).map(AccessControlMaxAge) |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| impl header::HeaderFormat for AccessControlMaxAge { |  | ||||||
|     fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { |  | ||||||
|         let AccessControlMaxAge(ref num) = *self; |  | ||||||
|         num.fmt(f) |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,5 +0,0 @@ | |||||||
| pub mod allow_headers; |  | ||||||
| pub mod allow_methods; |  | ||||||
| pub mod allow_origin; |  | ||||||
| pub mod request_headers; |  | ||||||
| pub mod request_method; |  | ||||||
| @@ -1,25 +0,0 @@ | |||||||
| use std::fmt::{mod}; |  | ||||||
|  |  | ||||||
| use header; |  | ||||||
| use header::shared; |  | ||||||
|  |  | ||||||
| #[deriving(Clone)] |  | ||||||
| struct AccessControlRequestHeaders(pub Vec<String>); |  | ||||||
|  |  | ||||||
| impl header::Header for AccessControlRequestHeaders { |  | ||||||
|     #[inline] |  | ||||||
|     fn header_name(_: Option<AccessControlRequestHeaders>) -> &'static str { |  | ||||||
|         "Access-Control-Request-Headers" |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     fn parse_header(raw: &[Vec<u8>]) -> Option<AccessControlRequestHeaders> { |  | ||||||
|         shared::from_comma_delimited(raw).map(AccessControlRequestHeaders) |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| impl header::HeaderFormat for AccessControlRequestHeaders { |  | ||||||
|     fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { |  | ||||||
|         let AccessControlRequestHeaders(ref parts) = *self; |  | ||||||
|         shared::fmt_comma_delimited(f, parts.as_slice()) |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,26 +0,0 @@ | |||||||
| use std::fmt::{mod}; |  | ||||||
|  |  | ||||||
| use header; |  | ||||||
| use header::shared; |  | ||||||
| use method::Method; |  | ||||||
|  |  | ||||||
| #[deriving(Clone)] |  | ||||||
| struct AccessControlRequestMethod(pub Method); |  | ||||||
|  |  | ||||||
| impl header::Header for AccessControlRequestMethod { |  | ||||||
|     #[inline] |  | ||||||
|     fn header_name(_: Option<AccessControlRequestMethod>) -> &'static str { |  | ||||||
|         "Access-Control-Request-Method" |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     fn parse_header(raw: &[Vec<u8>]) -> Option<AccessControlRequestMethod> { |  | ||||||
|         shared::from_one_raw_str(raw).map(AccessControlRequestMethod) |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| impl header::HeaderFormat for AccessControlRequestMethod { |  | ||||||
|     fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { |  | ||||||
|         let AccessControlRequestMethod(ref method) = *self; |  | ||||||
|         method.fmt(f) |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -74,9 +74,6 @@ macro_rules! deref( | |||||||
|     } |     } | ||||||
| ); | ); | ||||||
|  |  | ||||||
| // Exposes the AccessControl* family of headers. |  | ||||||
| pub mod access_control; |  | ||||||
|  |  | ||||||
| /// Exposes the Accept header. | /// Exposes the Accept header. | ||||||
| pub mod accept; | pub mod accept; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user