If a sorting criteria different than the default is used, carry the URL
arguments to the links pointing to other directories, so the sorting is
"remembered" when navigating across different directories.
When choosing different sorting criteria for the elements (with the "?C=x"
URL argument), allow also specifying a second "O=x" argument for the
direction: "?C=x&O=A" selects ascending direction, while "?C=x&O=D" chooses
descending direction.
This introduces Apache-style URL arguments to specify how to sort the
entries in the generated listings:
- Appending "?C=M" sorts by modification time (mtime).
- Appending "?C=S" sorts by file size.
- Any other (or no arguments) use the default sorting, by name.
When issuing subrequests (currently for non-builtin headers and footers),
initialize the headers_out.status field to NGX_OK.
Also, change the check of the result from ngx_http_send_header() to only
check for NGX_OK, as it is redundant to check it and also NGX_ERROR.
Unfortunately ngx_escape_uri() does not properly escape all characters
that may be problematic in URIs, so apart from doing a first pass with
ngx_escape_uri(), it is needed to do a second pass for escaping the rest
of characters.
Thanks to Steve Willing <eiji-gravion@hotmail.com> for reporting the issue.
Adds a new "fancyindex_ignore string1 [string2 [... stringN]]" directive
which sets a lists of files which are not to be shown in generated listings.
If Nginx is built with PCRE support, strings are interpreted as regular
expressions, and files which match one of the regular expressions in this
list will not be sent in listings.
This allows for inserting a <link> tag in the generated listings pointing to
an additional CSS stylesheet, which will be applied by the browser after the
built-in rules. This allows for super-easy customization of the output look.
Sergey A. Osokin provided this small improvement for the his previous patch
regarding the "zero_in_uri" being absent in newer development versions of
Nginx.
Signed-off-by: Adrian Perez <aperez@igalia.com>
(e.g. due to EACCESS), the fancyindex module would produce an error and
wouldn't generate any response to the user.
The new behavior is to log a non-critical error and keep serving the page
anyway.
Signed-off-by: Benoit Sigoure <tsunanet@gmail.com>
Signed-off-by: Adrian Perez <aperez@igalia.com>
ngx_chain_t instead of always calling the output filter three times.
This should avoid possible blocking in Nginx code.
- Added warning about using external URLs in subrequest in readme file.
- Factorized out some variable declarations out to function header. Removed
a shadowed variable.
- Removed some debugging statements.
- Fixed flags for the readme mode, now they are disjoint. This fixed some
other related things.
- Renamed fancyindex_readme_options to fancyindex_readme_mode (shorter
and clearer, IMHO)
- Renamed fancyindex_mode to fancyindex_include_mode (clearer).
- Checks for bottom/top readme are now properly done.
- Fix: Initialization of readme_flags now is zero instead of NGX_CONF_UNSET.
- Improved iteration of builtin template.
- Renamed some ngx_http_fancyindex_* symbols to nfi_* ones (shorter :P)
- Defined some memory-copy utility macros in templates/templates.h
- Updated output size calculation.