Skip to main content

contains_token

Function contains_token 

Source
pub fn contains_token<'a, I>(lines: I, token: &[u8]) -> bool
where I: IntoIterator<Item = &'a [u8]>,
Expand description

Whether any element of any line equals token, ignoring ASCII case.

For Connection: keep-alive, Upgrade and Upgrade: websocket. A line that fails to parse counts as not containing the token (fail closed).

ยงExamples

use parse_net::list::contains_token;

assert!(contains_token([&b"keep-alive, Upgrade"[..]], b"upgrade"));
assert!(!contains_token([&b"keep-alive, \"upgrade"[..]], b"upgrade"));