Skip to main content

Module files

Module files 

Source
Expand description

Serve files from the served directories without following symbolic links out of them (the default; see โ€“follow-symlinks).

Files are streamed, with Last-Modified and ETag for revalidation (If-None-Match, If-Modified-Since) and single byte ranges, as tower-httpโ€™s ServeDir does.

Structsยง

Roots
The directories files are served from, in order, each with its real path (symbolic links resolved).
Validators ๐Ÿ”’
The validators of a file: its ETag and its modification time.

Enumsยง

Found ๐Ÿ”’
What a request path names.
Part ๐Ÿ”’
The part of a file of len bytes that a Range header asks for.

Constantsยง

CHUNK ๐Ÿ”’
The bytes read from a file at a time.

Functionsยง

is_opened ๐Ÿ”’
Whether the file at real is opened (whose metadata is meta).
open_file ๐Ÿ”’
Open file for reading, without blocking should it be a FIFO.
part ๐Ÿ”’
Read a Range header. Only one range of bytes is served; anything else, several ranges or one that does not parse, gets the whole file.
respond ๐Ÿ”’
The response for an opened file: 304, 206, 416 or 200, streamed.
secs ๐Ÿ”’
serve
Serve a file from roots, refusing those reached through a symbolic link that leads out of them (see โ€“follow-symlinks).
stream ๐Ÿ”’
count bytes of file from first, read a chunk at a time as the client takes them, so that memory does not grow with the fileโ€™s size.
windows_unsafe ๐Ÿ”’
Whether Windows would take segment for something other than the file it names: a device (NUL, COM1.txt), or a name it trims (a.bob., a.bob ) and so opens another file under.