Rust
Rust
Setting a HTTP Max Response Size
Demonstrates theMaxResponseSize property.
Chilkat Rust Downloads
let http = chilkat::Http::new();
let max_sz = 16384;
http.set_max_response_size(max_sz);
// Try to get something larger, such as hamlet.xml which is 279658 bytes
let Ok(xml_str) = http.quick_get_str("https://chilkatsoft.com/hamlet.xml") else {
// If the LastErrorText contains the string "MaxResponseSize",
// then the HTTP request failed because the response body would've been larger than the max allowed response size.
println!("{}", http.last_error_text());
return;
};
println!("OK");