feat: filter pings

This commit is contained in:
2026-03-26 12:20:09 +04:00
parent 091096aa11
commit 7b5411ab64
3 changed files with 149 additions and 21 deletions
+13 -1
View File
@@ -343,7 +343,19 @@ fn run_check_blocking(
}
const MAX_BODY: usize = 10 * 1024 * 1024;
let body_str = resp.body_mut().read_to_string().unwrap_or_default();
let body_str = match resp.body_mut().read_to_string() {
Ok(s) => s,
Err(e) => {
// Try reading as raw bytes (e.g. compressed or non-UTF-8 responses)
let mut buf = Vec::new();
let _ = std::io::Read::read_to_end(resp.body_mut().as_reader(), &mut buf);
if buf.is_empty() {
format!("[failed to read body: {}]", e)
} else {
String::from_utf8_lossy(&buf).into_owned()
}
}
};
let body_out = if body_str.len() > MAX_BODY {
format!("[body truncated: {} bytes]", body_str.len())
} else {