style(headers): Remove commented out code in headers.
This commit is contained in:
@@ -22,56 +22,6 @@ header! {
|
|||||||
(IfNoneMatch, "If-None-Match") => {Any / (EntityTag)+}
|
(IfNoneMatch, "If-None-Match") => {Any / (EntityTag)+}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*/// The `If-None-Match` header defined by HTTP/1.1.
|
|
||||||
///
|
|
||||||
/// The "If-None-Match" header field makes the request method conditional
|
|
||||||
/// on a recipient cache or origin server either not having any current
|
|
||||||
/// representation of the target resource, when the field-value is "*",
|
|
||||||
/// or having a selected representation with an entity-tag that does not
|
|
||||||
/// match any of those listed in the field-value.
|
|
||||||
///
|
|
||||||
/// A recipient MUST use the weak comparison function when comparing
|
|
||||||
/// entity-tags for If-None-Match (Section 2.3.2), since weak entity-tags
|
|
||||||
/// can be used for cache validation even if there have been changes to
|
|
||||||
/// the representation data.
|
|
||||||
///
|
|
||||||
/// Spec: https://tools.ietf.org/html/rfc7232#section-3.2
|
|
||||||
|
|
||||||
/// The `If-None-Match` header field.
|
|
||||||
#[derive(Clone, PartialEq, Debug)]
|
|
||||||
pub enum IfNoneMatch {
|
|
||||||
/// This corresponds to '*'.
|
|
||||||
Any,
|
|
||||||
/// The header field names which will influence the response representation.
|
|
||||||
EntityTags(Vec<EntityTag>)
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Header for IfNoneMatch {
|
|
||||||
fn header_name() -> &'static str {
|
|
||||||
"If-None-Match"
|
|
||||||
}
|
|
||||||
|
|
||||||
fn parse_header(raw: &[Vec<u8>]) -> Option<IfNoneMatch> {
|
|
||||||
from_one_raw_str(raw).and_then(|s: String| {
|
|
||||||
let slice = &s[..];
|
|
||||||
match slice {
|
|
||||||
"" => None,
|
|
||||||
"*" => Some(IfNoneMatch::Any),
|
|
||||||
_ => from_comma_delimited(raw).map(|vec| IfNoneMatch::EntityTags(vec)),
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl HeaderFormat for IfNoneMatch {
|
|
||||||
fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
match *self {
|
|
||||||
IfNoneMatch::Any => { write!(fmt, "*") }
|
|
||||||
IfNoneMatch::EntityTags(ref fields) => { fmt_comma_delimited(fmt, &fields[..]) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::IfNoneMatch;
|
use super::IfNoneMatch;
|
||||||
|
|||||||
@@ -17,43 +17,6 @@ header! {
|
|||||||
(Vary, "Vary") => {Any / (UniCase<String>)+}
|
(Vary, "Vary") => {Any / (UniCase<String>)+}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*/// The `Allow` header.
|
|
||||||
/// See also https://tools.ietf.org/html/rfc7231#section-7.1.4
|
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Debug)]
|
|
||||||
pub enum Vary {
|
|
||||||
/// This corresponds to '*'.
|
|
||||||
Any,
|
|
||||||
/// The header field names which will influence the response representation.
|
|
||||||
Headers(Vec<UniCase<String>>),
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Header for Vary {
|
|
||||||
fn header_name() -> &'static str {
|
|
||||||
"Vary"
|
|
||||||
}
|
|
||||||
|
|
||||||
fn parse_header(raw: &[Vec<u8>]) -> Option<Vary> {
|
|
||||||
from_one_raw_str(raw).and_then(|s: String| {
|
|
||||||
let slice = &s[..];
|
|
||||||
match slice {
|
|
||||||
"" => None,
|
|
||||||
"*" => Some(Vary::Any),
|
|
||||||
_ => from_comma_delimited(raw).map(|vec| Vary::Headers(vec)),
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl HeaderFormat for Vary {
|
|
||||||
fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
match *self {
|
|
||||||
Vary::Any => { write!(fmt, "*") }
|
|
||||||
Vary::Headers(ref fields) => { fmt_comma_delimited(fmt, &fields[..]) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::Vary;
|
use super::Vary;
|
||||||
|
|||||||
Reference in New Issue
Block a user