Skip to main content

Module http

Module http 

Source
Expand description

HTTP client helper with native-tls support.

This module provides a configured HTTP agent that uses native-tls for TLS connections, which works better in VM environments where ring/rustls may have issues.

§Security

validate_download_url enforces HTTPS-only and a host allowlist for shader-download URLs, matching the validation used by the self-update subsystem in par-term-update. get_validated additionally re-applies that allowlist to every redirect hop rather than only to the URL the caller passed in.

Per-hop revalidation is hardening, not a fix for an observed exploit: no redirect off an allowlisted GitHub host has been demonstrated. It closes the gap that the allowlist was only ever checked once, before the first request.

Constants§

MAX_DOWNLOAD_SIZE
Maximum response body size for file downloads (50 MB).

Functions§

agent
Create a new HTTP agent configured with native-tls and a global timeout.
download_file
Download a file from a URL and return its bytes.
get_validated
Perform a GET, following redirects manually with the allowlist re-applied at every hop.
validate_download_url
Validate that a URL is safe to use for shader download operations.