Skip to main content

Module read_source

Module read_source 

Source
Expand description

Reading the text a command-line argument names: standard input for -, a URL when the argument starts with a scheme, otherwise a file path.

Structs§

ReadLimits
The bounds on a remote read.

Constants§

FETCH_TIMEOUT
How long one remote read may take, from sending the request to the last byte of the body. A command has no one watching a progress indicator, so a server that accepts the connection and then stalls would otherwise hang it for as long as the socket stays open. Generous enough for a slow link to deliver a document within MAX_RESPONSE_BYTES.
MAX_RESPONSE_BYTES
The most bytes a remote body may hold: 64 MiB. The body is buffered whole and then parsed as one JSON text, so the peak memory is a multiple of its size, and a server (or a redirect to one) that streams without end would otherwise grow the process until it is killed. A crosswalk is a few kilobytes and a document or sample set is data a person chose to apply it to, so the bound sits well above any plausible input.

Functions§

read_source
Reads the text an argument names. http: and https: are fetched, following redirects, within limits; data: is decoded; file: is turned into a path and read as paths are. Any other scheme is refused.