Skip to main content

Module http

Module http 

Source
Expand description

HTTP transport: control files, byte ranges, and planning range requests.

HttpClient fetches a control file and the byte ranges of a target. The free functions turn the block ranges a matcher still needs into byte ranges, and merge ranges separated by small gaps, since one request that re-downloads a few known bytes is usually cheaper than another round trip.

Structs§

HttpClient
HTTP transport for fetching control files and byte ranges.
HttpRangeReader
The body of one range response, capped at the length requested.

Enums§

HttpError
Why a fetch failed.

Constants§

CONNECT_TIMEOUT
Cap on establishing a connection, covering the TCP handshake and TLS setup but never the transfer that follows.
DEFAULT_RANGE_GAP_THRESHOLD
Default gap threshold for range merging (256 KiB, same as zsync2).
RESOLVE_TIMEOUT
Cap on the DNS lookup, for the same reason as CONNECT_TIMEOUT.

Functions§

byte_ranges_from_block_ranges
Converts block ranges into the byte ranges that hold them.
merge_byte_ranges
Merge byte ranges to minimize HTTP requests.