Struct http_serve::dir::Node [−][src]
pub struct Node { /* fields omitted */ }
dir
only.Expand description
An opened path (aka inode on Unix) as returned by FsDir::open
.
This is not necessarily a plain file; it could also be a directory, for example.
The caller can inspect it as desired. If it is a directory, the caller might pass the result of
into_file()
to nix::dir::Dir::from
. If it is a plain file, the caller might create an
http_serve::Entity
with into_file_entity()
.
Implementations
Converts this node (which must represent a plain file) into a ChunkedReadFile
.
The caller is expected to supply all headers. The function add_encoding_headers
may be useful.
Returns the encoding this file is assumed to have applied to the caller’s request.
E.g., if automatic gzip compression is enabled and index.html.gz
was found when the
caller requested index.html
, this will return Some("gzip")
. If the caller requests
index.html.gz
, this will return None
because the gzip encoding is built in to the
caller’s request.
Returns true iff the content varies with the request’s Accept-Encoding
header value.
Adds Content-Encoding
and Vary
headers for the encoding to hdrs
.
Note if there are other Vary
header components known to the caller, this method is
inappropriate.