feat: filter pings
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user