The castore-http crate provides both a binary and a library interface to
serve a single castore root node over HTTP.
The library function `get_root_node_contents` will return a
`axum::Response` for a requested path in the castore root node
depending on the requested paths type.
If the requested path in the root node is a directory, we return:
- a index file if there is a file matching one of the configurable
`index_names`
- a directory listing, if no `index_names` were configured and
`auto_index` was enabled
- the FORBIDDEN status code if no `index_names` were set nor
`auto_index` was enabled
If the requested path in the root node is a file,
we return the file.
If the requested path in the root node is a symlink,
we figure out wether the target exists and return a REDIRECT.
If the requested path doesn't exist in the root node,
we respond with NOT_FOUND
The binary wraps this functionality and allows one to specify the
desired root node by providing its base-64 encoded representation as
well as the other configuration parameters affecting the behavior of
`get_root_node_contents`.
Change-Id: I737482299f788ec0244c54b52042f9eb655a05c2
Reviewed-on: https://cl.snix.dev/c/snix/+/30245
Autosubmit: Marijan Petričević <marijan.petricevic94@gmail.com>
Reviewed-by: Marijan Petričević <marijan.petricevic94@gmail.com>
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>