accept_ranges.rs |
|
981 |
access_control_allow_credentials.rs |
|
2276 |
access_control_allow_headers.rs |
|
2678 |
access_control_allow_methods.rs |
|
2371 |
access_control_allow_origin.rs |
|
4945 |
access_control_expose_headers.rs |
|
2330 |
access_control_max_age.rs |
|
1140 |
access_control_request_headers.rs |
|
2395 |
access_control_request_method.rs |
|
2207 |
age.rs |
|
1788 |
allow.rs |
|
1580 |
authorization.rs |
Authorization header and types. |
8212 |
cache_control.rs |
|
15363 |
connection.rs |
|
3410 |
content_disposition.rs |
pub fn attachment(filename: &str) -> ContentDisposition {
let full = Bytes::from(format!("attachment; filename={}", filename));
match ::HeaderValue::from_maybe_shared(full) {
Ok(val) => ContentDisposition(val),
Err(_) => {
unimplemented!("filename that isn't ASCII");
}
}
}
|
11714 |
content_encoding.rs |
|
2115 |
content_length.rs |
__hyper__tm!(ContentLength, tests {
// Testcase from RFC
test_header!(test1, vec![b"3495"], Some(HeaderField(3495)));
test_header!(test_invalid, vec![b"34v95"], None);
// Can't use the test_header macro because "5, 5" gets cleaned to "5".
#[test]
fn test_duplicates() {
let parsed = HeaderField::parse_header(&vec![b"5".to_vec(),
b"5".to_vec()].into()).unwrap();
assert_eq!(parsed, HeaderField(5));
assert_eq!(format!("{}", parsed), "5");
}
test_header!(test_duplicates_vary, vec![b"5", b"6", b"5"], None);
});
|
3025 |
content_location.rs |
|
1430 |
content_range.rs |
|
6984 |
content_type.rs |
|
4936 |
cookie.rs |
impl PartialEq for Cookie {
fn eq(&self, other: &Cookie) -> bool {
if self.0.len() == other.0.len() {
for &(ref k, ref v) in self.0.iter() {
if other.get(k) != Some(v) {
return false;
}
}
true
} else {
false
}
}
}
|
5993 |
date.rs |
|
896 |
etag.rs |
test_etag {
// From the RFC
test_header!(test1,
vec![b"\"xyzzy\""],
Some(ETag(EntityTag::new(false, "xyzzy".to_owned()))));
test_header!(test2,
vec![b"W/\"xyzzy\""],
Some(ETag(EntityTag::new(true, "xyzzy".to_owned()))));
test_header!(test3,
vec![b"\"\""],
Some(ETag(EntityTag::new(false, "".to_owned()))));
// Own tests
test_header!(test4,
vec![b"\"foobar\""],
Some(ETag(EntityTag::new(false, "foobar".to_owned()))));
test_header!(test5,
vec![b"\"\""],
Some(ETag(EntityTag::new(false, "".to_owned()))));
test_header!(test6,
vec![b"W/\"weak-etag\""],
Some(ETag(EntityTag::new(true, "weak-etag".to_owned()))));
test_header!(test7,
vec![b"W/\"\x65\x62\""],
Some(ETag(EntityTag::new(true, "\u{0065}\u{0062}".to_owned()))));
test_header!(test8,
vec![b"W/\"\""],
Some(ETag(EntityTag::new(true, "".to_owned()))));
test_header!(test9,
vec![b"no-dquotes"],
None::<ETag>);
test_header!(test10,
vec![b"w/\"the-first-w-is-case-sensitive\""],
None::<ETag>);
test_header!(test11,
vec![b""],
None::<ETag>);
test_header!(test12,
vec![b"\"unmatched-dquotes1"],
None::<ETag>);
test_header!(test13,
vec![b"unmatched-dquotes2\""],
None::<ETag>);
test_header!(test14,
vec![b"matched-\"dquotes\""],
None::<ETag>);
test_header!(test15,
vec![b"\""],
None::<ETag>);
}
|
3131 |
expect.rs |
|
2015 |
expires.rs |
|
1150 |
host.rs |
|
1319 |
if_match.rs |
|
2820 |
if_modified_since.rs |
|
1961 |
if_none_match.rs |
test_if_none_match {
test_header!(test1, vec![b"\"xyzzy\""]);
test_header!(test2, vec![b"W/\"xyzzy\""]);
test_header!(test3, vec![b"\"xyzzy\", \"r2d2xxxx\", \"c3piozzzz\""]);
test_header!(test4, vec![b"W/\"xyzzy\", W/\"r2d2xxxx\", W/\"c3piozzzz\""]);
test_header!(test5, vec![b"*"]);
}
|
2959 |
if_range.rs |
#[cfg(test)]
mod tests {
use std::str;
use *;
use super::IfRange as HeaderField;
test_header!(test1, vec![b"Sat, 29 Oct 1994 19:43:31 GMT"]);
test_header!(test2, vec![b"\"xyzzy\""]);
test_header!(test3, vec![b"this-is-invalid"], None::<IfRange>);
}
|
3911 |
if_unmodified_since.rs |
|
2082 |
last_modified.rs |
|
1219 |
location.rs |
|
1176 |
mod.rs |
A Collection of Header implementations for common HTTP Headers.
## Mime
Several header fields use MIME values for their contents. Keeping with the
strongly-typed theme, the [mime](https://docs.rs/mime) crate
is used, such as `ContentType(pub Mime)`. |
5922 |
origin.rs |
|
6002 |
pragma.rs |
|
1622 |
proxy_authorization.rs |
|
1585 |
range.rs |
|
14220 |
referer.rs |
|
1487 |
referrer_policy.rs |
|
5576 |
retry_after.rs |
|
3358 |
sec_websocket_accept.rs |
from request headers |
1825 |
sec_websocket_key.rs |
|
207 |
sec_websocket_version.rs |
|
1530 |
server.rs |
|
1835 |
set_cookie.rs |
|
3709 |
strict_transport_security.rs |
|
7723 |
te.rs |
|
1026 |
transfer_encoding.rs |
|
2946 |
upgrade.rs |
|
1544 |
user_agent.rs |
|
2095 |
vary.rs |
test_vary {
test_header!(test1, vec![b"accept-encoding, accept-language"]);
#[test]
fn test2() {
let mut vary: ::Result<Vary>;
vary = Header::parse_header(&"*".into());
assert_eq!(vary.ok(), Some(Vary::Any));
vary = Header::parse_header(&"etag,cookie,allow".into());
assert_eq!(vary.ok(), Some(Vary::Items(vec!["eTag".parse().unwrap(),
"cookIE".parse().unwrap(),
"AlLOw".parse().unwrap(),])));
}
}
|
1957 |