pub async fn request(http_req: HttpRequest) -> HttpStat
Expand description
Performs an HTTP request and returns detailed statistics about the request lifecycle.
This function handles HTTP/1.1, HTTP/2, and HTTP/3 requests with the following features:
- Automatic protocol selection based on ALPN negotiation
- DNS resolution with support for custom IP mappings
- TLS handshake with certificate verification
- Response body handling with optional file output
- Detailed timing statistics for each phase of the request
§Arguments
http_req
- AnHttpRequest
struct containing the request configuration including:- URI and HTTP method
- ALPN protocols to negotiate
- Custom DNS resolutions
- Headers and request body
- TLS verification settings
- Output file path (optional)
§Returns
Returns an HttpStat
struct containing:
- DNS lookup time
- QUIC connection time
- TCP connection time
- TLS handshake time (for HTTPS)
- Server processing time
- Content transfer time
- Total request time
- Response status and headers
- Response body (if not written to file)
- TLS and certificate information (for HTTPS)
- Any errors that occurred during the request