Download code/bugfind/bench/kernels/tinyhttp_hdr/pre/src/lib.rs from viai957/align: direct link, hf CLI and curl.
- Browser
- Download file 502 Bytes
-
https://huggingface.co/viai957/align/resolve/main/code/bugfind/bench/kernels/tinyhttp_hdr/pre/src/lib.rs
- Command line
-
hf download hf://viai957/align/code/bugfind/bench/kernels/tinyhttp_hdr/pre/src/lib.rs
-
curl -L -o lib.rs https://huggingface.co/viai957/align/resolve/main/code/bugfind/bench/kernels/tinyhttp_hdr/pre/src/lib.rs
502 Bytes
| fn is_ws(b: u8) -> bool { | |
| b == b' ' || b == b'\t' || b == b'\n' || b == b'\r' || b == 11u8 || b == 12u8 | |
| } | |
| pub fn header_field_ok(s: &[u8]) -> bool { | |
| let mut start = 0usize; | |
| let mut end = s.len(); | |
| while start < end && is_ws(s[start]) { | |
| start += 1; | |
| } | |
| while end > start && is_ws(s[end - 1]) { | |
| end -= 1; | |
| } | |
| let mut ok = true; | |
| let mut i = start; | |
| while i < end { | |
| if s[i] >= 128 { | |
| ok = false; | |
| } | |
| i += 1; | |
| } | |
| ok | |
| } | |