Skip to main content

Module http

Module http 

Source
Expand description

Reusable HTTP client with pre-configured TLS, timeouts, and user agent.

This module provides Client as the recommended base HTTP client for all network requests in the application. It is pre-configured with:

  • TLS using webpki-roots certificates (no system cert store required)
  • 30 second request timeout
  • User agent identifying the application

ยงExample

use cadmus_core::http::Client;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new()?;
    client.get("https://example.com").send()?;
    Ok(())
}

Structsยง

Client
Pre-configured HTTP client for making network requests.

Enumsยง

ChunkedDownloadError
Error types that can occur during a chunked HTTP download.
HttpError

Constantsยง

CLIENT_TIMEOUT_SECS
INITIAL_CHUNK_SIZE ๐Ÿ”’
MAX_CHUNK_SIZE ๐Ÿ”’
MAX_RETRIES ๐Ÿ”’
MIN_CHUNK_SIZE ๐Ÿ”’
TARGET_CHUNK_SECS ๐Ÿ”’
Target 80% of the HTTP timeout to leave headroom for throughput variance.
USER_AGENT ๐Ÿ”’

Functionsยง

build_root_store ๐Ÿ”’