Expand description
Obtain the HTTP timings for any given URL
This crate provides a way to measure the HTTP timings for any given URL. This crate also provides basic and the certificate information for the given URL.
Example:
use http_timings::from_string;
use std::time::Duration;
let url = "https://www.example.com";
let timeout = Some(Duration::from_secs(5)); // Set a timeout of 5 seconds
match from_string(url, timeout) {
Ok(response) => {
println!("Response Status: {}", response.status);
println!("Response Body: {}", response.body);
if let Some(cert_info) = response.certificate_information {
println!("Certificate Subject: {:?}", cert_info.subject);
println!("Certificate Issued At: {:?}", cert_info.issued_at);
println!("Certificate Expires At: {:?}", cert_info.expires_at);
println!("Is Certificate Active: {:?}", cert_info.is_active);
} else {
println!("No certificate information available.");
}
},
Err(e) => {
eprintln!("Error occurred: {:?}", e);
}
}
Modules§
- error
- Error types
Structs§
- Certificate
Information - Basic information about an SSL certificate
- Duration
Pair - A pair of durations, one total and one relative
- Response
- The response from a given request
- Response
Timings - The response timings for any given request. The response timings can be found here.
Traits§
- Read
Write ReadWrite
trait
Functions§
- from_
string - Given a string, it will be parsed as a URL and the HTTP timings will be measured
- from_
url - Measures the HTTP timings from the given URL