Compare commits

...

183 commits
v0.3 ... master

Author SHA1 Message Date
Adrian Perez de Castro
cbc0d3fca4 CI: Update mainline and stable Nginx versions for testing 2023-01-20 15:31:11 +02:00
Ryan Schmidt
e5f227686a Add tests for case-(in)sensitive sorting 2023-01-20 15:26:16 +02:00
Mamadou Lamine NIANG
a634077b5f Add case-insensitive name sorting support
Add the fancyindex_case_sensitive option which considers the case when
sorting by name if it is on (which it is by default to keep current
behavior) and does a case-insensitive name sort if it is off.

Closes #78
Closes #124

Co-authored-by: Ryan Schmidt <git@ryandesign.com>
2023-01-20 15:26:16 +02:00
Adrian Perez de Castro
674e99547d Add missing entry in long weekday names array
The entry for Saturday was missing, as pointed out in the bug report.
While at it, add a test case.

Fixes #157
2023-01-20 15:20:40 +02:00
Adrian Perez de Castro
1494521744 build-and-run: disable HTTP rewrite module
The HTTP rewrite module needs PCRE, which is not available in the GHA
MacOS runners. It is unused by the tests, so it's safe to disable
building it.
2023-01-20 13:59:17 +02:00
Danila Vershinin
f50d7b799f Update available distros with module package
Fedora Linux has packages available, removed linking to old NGINX module package version
2022-07-19 15:54:45 +03:00
Ryan Schmidt
860a9cbd5e CI: add macOS test runners 2022-06-05 01:02:12 +03:00
Ryan Schmidt
2346fa9bde CI: Update to latest mainline and stable nginx 2022-06-05 01:02:12 +03:00
Adrian Perez de Castro
823f162085
Use the BSD license consistently
The t/preamble file incorrectly mentioned the MIT license before.
While at it, use SPDX license identification headers.

Closes #149
2022-05-26 00:40:58 +03:00
Ryan Schmidt
98f824ef91 get-pup: Use a fork of pup on recent macOS
Use a fork of pup on macOS 10.13 and higher because the binary provided
by the original project crashes immediately on those OS versions.

See https://github.com/ericchiang/pup/issues/85
2022-05-25 23:58:46 +03:00
Ryan Schmidt
8efe0b01fa Tests: Make test 02 more specific
Test for an opening table tag instead of just the word "table".
2022-05-25 23:53:42 +03:00
Ryan Schmidt
e505eb2a13 Tests: Wait for nginx to create pid file
When nginx is started, it returns control before it has created its pid
file. Since this test suite relies on the existence of the pid file,
wait until the pid file exists before returning from nginx_start. Time
out after 2 seconds so that if there is a real problem starting nginx
we don't wait forever.

Fixes #144
2022-05-25 23:52:58 +03:00
Ryan Schmidt
778561eabf README.rst: Note MacPorts can install fancyindex 2022-05-25 23:52:14 +03:00
Ryan Schmidt
83bef5c8a6 Fix 404 not found when indexing filesystem root
Backport of 4c89c09ad8

Fixes #107
2022-05-25 23:51:27 +03:00
Ryan Schmidt
b9ecd5bcb4 Tests: Fix typos in descriptions and messages 2022-05-10 22:04:11 +03:00
Ryan Schmidt
698e7ce4b9 get-pup: Verify with openssl instead of sha256sum
Use openssl to verify download because sha256sum does not exist on
macOS.
2022-05-10 21:58:05 +03:00
Ryan Schmidt
7ee6b81661 HACKING.md: Note MacPorts can install gawk too 2022-05-10 21:56:30 +03:00
Ryan Schmidt
e8a4a7eced template.awk: Fix name of HACKING file
HACKING was converted from reStructuredText to markdown back in 2014 in
0064164d4e.
2022-05-10 21:55:00 +03:00
Ryan Schmidt
3d47d0d6b1 README.rst: Fix typos and other minor edits 2022-05-10 21:54:12 +03:00
Ryan Schmidt
60e39e0929 .gitignore: Ignore nginx-*
After running t/build-and-run an nginx directory is left in the main
directory. Hide this from git status since we won't want to check it in.
2022-05-10 21:52:26 +03:00
Ryan Schmidt
a1890354e5 Tests: Build nginx in parallel on macOS 2022-05-10 19:55:34 +03:00
Ryan Schmidt
20ba8038ac Tests: Use netstat to list occupied ports on macOS
Use netstat instead of ss to list the occupied ports on macOS since
macOS doesn't have ss.

Closes #139
2022-05-10 19:46:26 +03:00
Anthony Ryan
5930c29d6a Remove fancyindex_name_length by offloading work to CSS
This is a backwards compatibility break, in that the `fancyindex_name_length` setting will now
prevent nginx from starting until removed. I do think though that most people will find the new
behavior preferable to that setting however.

There's two arguably unrelated CSS changes included in this pull request, so let me know if you
like one but not the other or vice versa I can split them up.

-----

We've introduced `table-layout: fixed;`. This is a performance optimization for browsers rendering
very large file lists.

The default mode (`table-layout: auto`) first needs to load the entire table, then calculates the
optimal column widths based on the contents of all cells in the table start to finish. This can be
a bit slow when directory listings contain tens of thousands of files or folders.

With `table-layout: fixed;` the width is determined based on the first row allowing the browser to
render to begin rendering the table immediately.

Technically, the widths of columns have changed slightly as a result of this, but we no longer need
to specify widths using style attributes, which makes it easier for custom CSS users to change the
widths.

.link was 55% wide, now 50%
.size was 20% wide, now 25%
.date was 25% wide, now 25%

-----

Rather than truncating string names server-side, we instead send the full name and tell the browser
to truncate file names with CSS. This has the advantage of always showing as much of the file name
as it can fit in a line. This has the benefit of avoiding line wraps on smaller screens (like
phones) and allowing people to resize their window larger to see more of the file name.

This reduces the code complexity server side and provides a optimal truncation on every device.
2021-10-28 22:37:48 +03:00
Adrian Perez de Castro
6cdffdb0af
Version 0.5.2 2021-10-28 22:28:07 +03:00
Adrian Perez de Castro
b0e1fa83a8 CI: Move over to GitHub Actions 2021-10-26 01:12:26 +03:00
Anthony Ryan
2e9555e759 Always use ngx_escape_html to ensure we aren't rendering file names
as HTML tags.
2021-10-25 16:19:03 +03:00
Adrian Perez de Castro
391d2d5447
CI: Update mainline version to 1.19.3 2021-02-25 19:01:53 +02:00
Tim Gates
566ad22a61 docs: fix simple typo, configration -> configuration
There is a small typo in ngx_http_fancyindex_module.c.

Should read `configuration` rather than `configration`.
2020-12-21 17:20:44 +01:00
Adrian Perez de Castro
5ca7cb32af
Version 0.5.1 2020-10-26 22:45:29 +02:00
Adrian Perez de Castro
c33b05af9e Fix check for arguments to fancyindex_{header,footer}
Closes #117
2020-10-26 22:41:38 +02:00
Adrian Perez de Castro
4fc6bb10d7
Version 0.5.0 2020-10-24 19:07:36 +03:00
Adrian Perez de Castro
618e2d154e
Add missing "use pup" command to t/07-directory-first.test 2020-10-24 18:53:53 +03:00
Adrian Perez de Castro
f52bacea8f Add unit tests for local headers and footers 2020-10-24 18:52:58 +03:00
Adrian Perez de Castro
527511fbf8 Load local header and footer files when configuring
Make the configuration process load the local files specified with
'fancyindex_{header,footer} "foo" local', instead of loading them
on every request.

Additionally, change the syntax of the configuration directive to accept
an optional parameter indicating whether the header (or footer) is to be
loaded as a subrequest (default, for backwards compatibility) or a local
file (must be specified explicitly). This avoids the footgun of having
a local file which accidentally happens to match the subrequest that one
had the intention to do when configuring.
2020-10-24 18:52:58 +03:00
JoungKyun Kim
5ac161ccc3 fixed #82 fancyindex can't print list with auth-ldap module
- fixed signedness problems
- fixed gabage characters
2020-10-24 18:34:41 +03:00
Adrian Perez de Castro
140dcb7a8f Properly escape square brackets with old Nginx versions 2020-10-24 15:40:07 +03:00
Adrian Perez de Castro
6637a7afab Update to Nginx 0.8 as oldest supported version 2020-10-24 15:40:07 +03:00
Adrian Perez de Castro
d3d7adc89d README: Update CI link to use travis-ci.com instead of .org 2020-10-24 14:08:56 +03:00
Adrian Perez de Castro
52a17b7a17 CI: Update Nginx mainline and stable versions 2020-10-24 14:08:56 +03:00
z4yx
63d19686df add a test of ngx_http_fancyindex_cmp_entries_dirs_first 2020-10-24 13:17:10 +03:00
z4yx
b3e06fd31b remove ngx_http_fancyindex_cmp_entries_dirs_first 2020-10-24 13:17:10 +03:00
z4yx
c0448985b6 ngx_int_t -> int 2020-10-24 13:17:10 +03:00
z4yx
a05006e3c4 replace ngx_sort with ngx_qsort 2020-10-24 13:17:10 +03:00
Joshua Shaffer
56934db14c update readme 2020-05-26 16:14:09 +03:00
Joshua Shaffer
42e21c9153 Added test for show_dotfiles 2020-05-26 16:14:09 +03:00
Joshua Shaffer
7444208a36 t/* should be eol=lf so bash can run 2020-05-26 16:14:09 +03:00
Joshua Shaffer
94bb8164b2 Fixes #54. Adds configuration option 'fancyindex_show_dotfiles' to show dotfiles. 2020-05-26 16:14:09 +03:00
Adrian Perez de Castro
11101de198
make-dist: Add script to generate release tarballs
Because the source archives from GitHub tags may not always produce the
same tarball when fetching at different times. Having proper tarballs
for releases also allows signing them i.e. with PGP.
2020-02-19 13:05:55 +02:00
Adrian Perez de Castro
58fecc865d
Version 0.4.4 2020-02-19 12:56:12 +02:00
Anders Trier
21a084d61d Add CRLF after the 'Parent directory' line. This makes the output easier to parse. 2020-02-19 12:44:32 +02:00
kPherox
fa13aef31b Add test for fancyindex_hide_parent_dir on 2018-10-15 11:28:09 +02:00
kPherox
47ce20d993 refs aperezdc/ngx-fancyindex#57 Add fancyindex_hide_parent_dir directive 2018-10-15 11:28:09 +02:00
Nicolas CARPi
7abb6e3693 Fix some issues in the README file
* fix nginx URL (.org not .net and HTTPS)
* fix protocol for die.net URL
* fix underline too short for fancyindex_show_path
* fix "module module" sentence
2018-10-15 02:10:55 +02:00
Adrian Perez de Castro
473c1de024 Properly encode filenames as URI components
Fixes #95
2018-08-30 00:12:47 +03:00
Adrian Perez de Castro
a3929d7074 CI: Update Nginx mainline to version 1.15.2 2018-08-15 14:28:52 +02:00
David Beitey
e6ddb517ca Mention awk fails on macOS and provide a solution 2018-07-13 01:22:48 +03:00
David Beitey
aa0be2dcaa Fix encoding of &amp; chars in table header 2018-07-13 01:11:20 +03:00
Adrian Perez de Castro
d1b2f36738
Version 0.4.3 2018-07-03 02:53:45 +03:00
Adrian Perez de Castro
a983c2c899
Add test case for sort order by file-size after
This tests the fix from PR #88 and by having it in the test suite
it will make sure that sorting by size dos not get broken again.
2018-07-03 02:41:13 +03:00
qjqqyy
2b2244551f Fix decreasing sort by file size
fixes #77
2018-07-03 02:39:57 +03:00
Adrian Perez de Castro
6f812eba8e Add a test case which uses pup to check a listing 2018-07-03 02:16:45 +03:00
Adrian Perez de Castro
604b43b336 Add pup() and use() function to allow skipping when pup is unavailable
The "use pup" construct will skip a test case that needs pup installed.
The pup() function ensures that the downloaded binary is used.
2018-07-03 02:16:45 +03:00
Adrian Perez de Castro
60f09e450d Allow skipping test cases
This defines a skip() function in the tests preamble which can
be used to skip tests. Skipped tests are counted, and a reason
for them being skipped printed after running the tests.
2018-07-03 02:16:45 +03:00
Adrian Perez de Castro
501f9bc63c CI: Add script to fetch and validate a binary build of pup
The script downloads and validates the download against a built-in
list of known checksums for the release ZIP files.

More on pup: https://github.com/ericchiang/pup/
2018-07-03 02:16:45 +03:00
Adrian Perez de Castro
5f265ab6eb
Add themes by @fraoustin and @alehaa
Closes #87
2018-07-03 01:01:31 +03:00
Adrian Perez de Castro
df593a20f3 CI: Switch mainline Nginx to 0.15.0, update older versions
In particular, version 1.11.6 does not even appear in the main
download page. Of course the tarballs are still in the archives,
but not being listed seems like a good criteria to remove it from
the testing matrix. Also, change 1.10.2 to 1.10.3, which is the
latest minor release from the series.
2018-07-03 00:26:29 +03:00
Lilian Besson
5dd4ec3b3c Typo on code block formatting 2018-07-02 23:46:01 +03:00
Martchus
4ae6c87246 Test latest stable and mainline releases on Travis 2018-05-02 23:17:51 +03:00
Adrian Perez de Castro
c5bf62212e
CI: Update mainline/stable Nginx versions
Only the minor version number is changed, so there is no need to
keep the older versions being tested as well in the test matrix.
2018-03-21 17:19:44 +00:00
Adrian Perez de Castro
16e6feefa9
Update template.html to reflect recent changes in the code 2018-03-21 17:16:52 +00:00
gznyirfa
60c4338b96 add html class names to table cells for better css formatting options 2018-03-21 17:13:50 +00:00
Adrian Perez de Castro
9446fd7e4b
Release version 0.4.2 2017-08-19 00:31:37 +03:00
Adrian Perez de Castro
071697588c CI: Update mainline and stable Nginx versions
Previous mainline/stable versions are tested only as static builds.
2017-08-19 00:14:48 +03:00
Adrian Perez de Castro
c1b1be3615 Fix sorting by file size for sizes bigger than INT_MAX
Instead of directly return the difference of the sizes from the
comparison functions, use the relational operators, as suggested by
Chris Young (thanks!).

Fixes #74
2017-08-19 00:09:41 +03:00
Nick Geoghegan
b21ec45790 Fixes #72 2017-06-17 00:43:52 +03:00
Lilian Besson
eb2fd247ea Update link for the 2nd theme example
The linked project (and example) was dead. Mine is not. (https://github.com/Naereen/Nginx-Fancyindex-Theme)
2017-04-26 01:38:19 +03:00
Danila Vershinin
a97cc6639d Update README.rst 2017-04-22 17:49:57 +03:00
Danila Vershinin
6ffd207a56 Update requirements for CentOS 7
Adds reference to GetPageSpeed extras RPM repository and availability of fancy index dynamic module
2017-04-22 17:49:57 +03:00
Iulian Onofrei
6e2f3fbe1c Update README.rst
Add missing module loading command to the documentation
2017-01-17 12:31:35 +02:00
Adrian Perez de Castro
04936f197b
CI: Update mainline Nginx to 1.11.6 2016-12-08 15:33:17 +02:00
Adrian Perez de Castro
b1182f7758
Add test case 2016-12-08 15:33:13 +02:00
Adrian Perez
57ff1a2a89 Merge pull request #62 from 0xb8/fix-61
Fix segfaults when opening directories with empty files
2016-12-08 15:12:51 +02:00
cat
a551b5e3ea Fix segfaults when opening directories with empty files
Apparently ngx_sprintf does not tolerate format specifiers
not matching their corresponding argument types.
2016-12-08 15:15:59 +05:00
Adrian Perez de Castro
ee17ca1a65
Use in tests the generic method to pass config options
Instead of having variables being flipped around, just specify which Nginx
directives are needed in the configuration file.
2016-12-07 20:20:34 +02:00
Adrian Perez de Castro
5b53c2b0b2
Use &darr; entity references instead of character references
Entity references are encoding-independent, and will work despite of the
encoding of the rest of the served document. Note that in general it may be
a bad idea to use "fancyindex_header" to change the encoding of the served
documents because file names will still be treated as UTF-8, which is the
only sane default in Unix.

Fixes #50.
2016-12-07 19:18:11 +02:00
Adrian Perez de Castro
77d2c60c8e
CI: Update to Nginx stable 1.10.2 and mainline 1.11.5 2016-11-06 20:57:49 +02:00
Anders Trier Olesen
6442f26527 Add test for fancyindex_exact_size off 2016-11-04 01:31:05 +02:00
Anders Trier
1e438a694d Add decimal to file sizes 2016-11-04 01:31:05 +02:00
Fernando Costa
f2f0cdc9de Randomize test execution. 2016-10-18 23:51:08 +03:00
Adrian Perez de Castro
c5deb79e8f
Remove usage of cellpadding/cellspacing in default template
This closes issue #52
2016-08-31 02:26:58 +03:00
Adrian Perez de Castro
bdaceb6583
Do not use col/colgroup tags in default template
Avoid using <colgroup> and <col> tags, which are deprecated in favour
of using CSS for styling.

See issue #52 for more information.
2016-08-31 02:23:54 +03:00
Adrian Perez de Castro
a3a7626de9
Use the HTML5 document type declaration
The XHTML document makes the document not to validate because of the undefined
entity references, and it seems better to use the HTML5 document type instead
of the HTML 4.01 one because the template uses already some modern constructs
like defining the device viewport options.

Fixes issue #52.
2016-08-31 02:07:10 +03:00
Adrian Perez de Castro
71b7146577
Release version 0.4.1 2016-08-18 20:49:47 +03:00
Adrian Perez de Castro
0a8450c812
Travis-CI: Use the t/build-and-run script
This ensures that Travis-CI uses the same commands for building and testing as
developers are encouraged to.
2016-08-18 20:42:13 +03:00
Adrian Perez de Castro
5e621202bd
Use only the new-style module configuration for dynamic builds
For static builds we still need to manually reorder $HTTP_MODULES, and we
cannot source "auto/module" like the new-style configuration mode needs,
because the "auto/module" snippet modifies $HTTP_MODULES itself, but ignores
the new $ngx_module_order variable when doing a static build.

Fortunately, the old-style way of configuring the module is still working in
all Nginx versions for statically built modules, so we can keep using that
for static builds.

This fixes issue #46.
2016-08-18 20:30:43 +03:00
Adrian Perez de Castro
3ec11d5d87
config: Depend also on template.h
This makes the Nginx configure script add a rule to the generated Makefile which
makes the module depend on template.h
2016-08-18 19:22:03 +03:00
Adrian Perez de Castro
07fb4ab214
t/run: Add some spacing and formatting to failed test outputs
This makes it easier to identify the outputs for each one of the failed
tests.
2016-08-18 19:19:11 +03:00
Adrian Perez de Castro
a1bb63c93b
Script which replicates the build-and-test done by Travis-CI
This allows developers to build nginx and run the test suite locally by
running just one single command.
2016-08-18 18:16:30 +03:00
Adrian Perez de Castro
f051caa108
Tests: Add test descriptions 2016-08-18 18:16:16 +03:00
Adrian Perez de Castro
038434dd9f
Ensure that a clean environment is used to launch Nginx in tests
This avoids potential issues when running the tests in environments which
might set variables which Nginx tries to read on startup. For example,
the $NGINX variable was being picked from the Travis-CI build matrix
configuration.
2016-08-18 16:48:28 +03:00
Adrian Perez de Castro
3789187861
Tests: Smoke-test that the module is returning data 2016-08-18 00:44:07 +03:00
Adrian Perez de Castro
8d47b33509
Tests: Check that dynamic module is not built when build is not dynamic 2016-08-18 00:44:07 +03:00
Adrian Perez de Castro
3c70b9f5c8
Travis-CI: Use individual script steps, to allow collapsing them in the log 2016-08-18 00:44:07 +03:00
Adrian Perez de Castro
85ad712764
Tests: Move preamble out of t/run 2016-08-18 00:44:07 +03:00
Adrian Perez de Castro
3df2d5f715
CI: Install built Nginx ina prefix directory and invoke test harness 2016-08-18 00:44:07 +03:00
Adrian Perez de Castro
866a9e18a0
Add a rudimentary test harness 2016-08-18 00:44:06 +03:00
Adrian Perez de Castro
7dd46a6dd2
CI: Build the module dynamically as well 2016-08-18 00:44:06 +03:00
Adrian Perez de Castro
0fd28d123e
CI: Build also with Nginx 1.11.3 2016-08-18 00:43:54 +03:00
Adrian Perez de Castro
47131b01d1
CHANGELOG: Mention fancyindex_directories_first directive 2016-08-18 00:40:43 +03:00
Luke Zapart
2fa65b05f1
Add fancyindex_directories_first config directive.
The fancyindex_directories_first directive allows one to enable or
 disable grouping directories first before all files when sorting.

This is accomplished by changing the sort function from ngx_qsort (which
is the plain stdlib qsort under the hood) to ngx_sort which is a stable
insertion sort (per ngx_string.c).

We call ngx_sort with the standard sort_cmp_func (albeit modified to remove
grouping dirs), and then, if fancyindex_directories_first is set, call
ngx_sort again with ngx_http_fancyindex_cmp_entries_dirs_first which sorts
entries according to the directories first criterion.

Because a stable sorting function is used, the relative primary order is
preserved when we call ngx_sort again.

Change int (*sort_cmp_func) (const void*, const void*) to ngx_int_t
(*sort_cmp_func) (const void*, const void*) to satisfy ngx_sort.
2016-08-18 00:36:24 +03:00
Adrian Perez
73e67974ec Merge pull request #45 from nwrd/master
fix readme file
2016-06-26 22:01:54 +03:00
nwrd
1e037c8fba fix readme file 2016-06-26 19:08:36 +02:00
Adrian Perez de Castro
4f9058da72
Release version 0.4.0 2016-06-08 17:28:40 +03:00
Adrian Perez de Castro
ba8ca3b540
CHANGELOG: Fix typo 2016-06-08 17:17:00 +03:00
Adrian Perez de Castro
022c117576
README: Mention the possibility of compiling as dynamic module 2016-06-08 16:04:41 +03:00
Adrian Perez de Castro
aa18095ffc
Change the build status badge to use the Travis-CI one
Travis-CI better signifies the build status, as it tries building with
combinations of compilers, nginx versions, and dynamic vs. statically
linked modules.
2016-06-08 15:49:09 +03:00
Adrian Perez
06eda48a62 Merge pull request #44 from vrnagy/master
Support to be built as dynamic module
2016-06-08 15:40:04 +03:00
Róbert Nagy
0e5f7c00b6 Dynamic module config 2016-05-23 23:39:24 +02:00
Róbert Nagy
7ca820ec4d Test dynamic module build 2016-05-23 23:38:00 +02:00
Róbert Nagy
9d34233ff4 Test with nginx 1.8.1, 1.9.15, 1.10.0 2016-05-23 23:29:53 +02:00
Adrian Perez
ba8b4ece63 Merge pull request #39 from TPXP/add_show_path
Add the 'show_path' configuration directive
2016-02-16 01:31:04 +02:00
Thomas P
cb3d21157b Add the 'show_path' configuration directive
This directive enables someone using a custom header to disable the output of the indexed directory by the module

Useful when you want to create links to previous directories via PHP for example
2016-02-13 15:37:54 +01:00
Adrián Pérez de Castro
80bd501bbf Travis-CI: Add configuration 2016-02-10 18:55:26 +02:00
Adrián Pérez de Castro
891fb05fc9 Update CHANGELOG with latest merges 2016-02-10 16:23:21 +02:00
Adrian Perez
945f87c644 Merge pull request #31 from janglapuk/master
Add title attribute for each dir or file
2016-02-10 15:54:04 +02:00
Adrian Perez
c8e9a9a158 Merge pull request #37 from oschaaf/ngx-pagespeed-compatibility
Fix hang when combining fancyindex with ngx_pagespeed
2016-02-10 15:46:00 +02:00
Otto van der Schaaf
1450c1b4d5 Fix hang when combining fancyindex with ngx_pagespeed
This attempts to address hanging requests when fancyindex is
combined with ngx_pagespeed. The change makes fancyindex check
the return value of ngx_http_send_header in a way that is just
the same as nginx's autoindex module - which makes the modules
work for me when I test with ngx_pagespeed.
2016-02-10 13:15:30 +01:00
Adrián Pérez de Castro
c97e11ad6c Release version 0.3.6 2016-01-26 18:53:05 +02:00
Adrián Pérez de Castro
61f091aeb8 Update year to 2016 in copyright header 2016-01-26 18:52:54 +02:00
Adrian Perez
29e039e787 Merge pull request #35 from yzwduck/master
Fix Windows builds
2016-01-26 18:43:55 +02:00
YeahO_O Yuan
bbd0300488 Fix Windows builds
Suppress warnings for:
* non-ascii character;
* non-constant aggregate initializer;
* assignment within conditional expression;
* return value type mismatch.
2016-01-25 19:45:06 +08:00
janglapuk
07c4288e64 Added title attribute for each dir or file 2015-08-30 10:29:30 +08:00
stayn0ided
69105c65d8 fixed readme theme section 2015-08-23 12:51:47 +02:00
Peter Wemm
e5deb93745 Fix typo in fancyindex_hide_symlinks that causes a crash. 2015-08-16 21:18:13 -07:00
Adrian Perez de Castro
4d0200d22c README: Add one more theme 2015-08-17 01:08:23 +03:00
Adrian Perez de Castro
db017f815c CHANGELOG: Fix subsubsection spacing 2015-08-17 00:27:10 +03:00
Adrian Perez de Castro
c0c6d8bfc4 CHANGELOG: Make version numbers clickable 2015-08-17 00:25:28 +03:00
Adrian Perez de Castro
3f93d1f01d Fix propagation of fancyindex_css_href configuration directive
The value for fancyindex_css_href was not being propagated properly, so
overriding its value did not work as expected. For example the following
configuration:

    http {
	# ...
	fancyindex_css_href "/css/global.css";

	location /subdir/ {
	    fancyindex_css_href "/css/local.css";
	}
    }

would always use "global.css", even when accessing file listings under
"/subdir".

This patch fixes the issue.
2015-08-17 00:20:53 +03:00
Adrian Perez de Castro
5549286d39 Mark unused variables to avoid compiler warnings/errors
This avoids the compiler complaning when warnings for unused variables are
enabled.
2015-08-17 00:15:25 +03:00
Adrian Perez de Castro
13170fb6e6 Fix a couple of code style and indentation issues 2015-08-17 00:14:53 +03:00
Adrian Perez de Castro
5599bbebba Allow specifying timestamp format with fancyindex_time_format
This patch adds a new configuration directive fancyindex_time_format, which
accepts a strftime()-style format string used to format the timestamps in the
generated listings. The accepted format specifiers are an useful subset of
those supported by strftime(), but the libc function is not used to make the
output of the module stable and locale-independent.

This fixes issue #23.
2015-08-16 23:54:32 +03:00
Adrian Perez de Castro
fd0bbd7fb8 Fix indentation and spacing 2015-08-16 17:22:19 +03:00
Adrian Perez de Castro
cf8197c991 Fix initializer of fancyindex_hide_symlinks flag definition 2015-08-16 17:21:31 +03:00
Adrian Perez de Castro
42d10a2a24 Add option to hide symbolic links from generated listings
This adds a new "fancyindex_hide_symlinks" configuration flag, which will
filter out symbolic links from the generated file listings when enabled.

Feature suggested by Peter Wemm (https://github.com/DarkHelmet433)

Fixes issue #27
2015-08-16 13:08:04 +03:00
Adrian Perez de Castro
f39d834bff Record removal of top-level "parent" link in CHANGELOG 2015-08-16 02:29:43 +03:00
Thomas P
97987a45e4 Do not display the parent dir link at the root
If fancy indexing is used at the root of a webserver, it will still display
a "Parent Directory" link even when listing the webserver's root. This should
not happen as it outputs a useless link.
2015-08-16 02:27:37 +03:00
Adrian Perez de Castro
3f3b408c17 Mention http_addition_module warning at config time in CHANGELOG.md 2015-08-09 14:19:21 +03:00
Adrian Perez de Castro
f30f3ea818 Fix typo in CHANGELOG.md 2015-08-09 14:19:09 +03:00
Adrian Perez de Castro
fdce427a5c README: Mention the need for ngx_http_addition_module
The fancyindex_footer and fancyindex_header settings need the standard Nginx
ngx_http_addition_module built into Nginx. Add a note to this effect in the
README.

Also, a warning is issued at configuration time if the addition module is not
enabled in the configuration.

Closes issue #26.
2015-08-09 14:14:40 +03:00
Adrian Perez de Castro
b4bf5e9891 Use valid Markdown formatting in CHANGELOG.md 2015-02-19 13:18:17 +01:00
Adrian Perez de Castro
f358f406a0 Release version 0.3.5 2015-02-19 13:16:36 +01:00
Martin Herkt
dc64f24bbc Make file name length limit configurable 2015-02-19 13:10:27 +01:00
Mim
7a07987ad3 Make sorting criterion configurable 2015-02-19 13:06:27 +01:00
Adrian Perez de Castro
e5cbf4873d Link to theme designed by @TheInsomniac from README
Adds a link to the nice theme designed by @TheInsomiac, which is a
great example of advanced theming using "fancyindex_header" and
"fancyindex_footer".

Closes issue #11
2014-11-05 11:47:15 +02:00
Adrian Perez de Castro
4d1aa8680e Added drone.io status badge to README 2014-09-19 13:10:26 +03:00
Adrian Perez de Castro
edb81b0acc Remove devtodo's .todo 2014-09-08 10:50:49 +03:00
Adrian Perez de Castro
0064164d4e Convert HACKING.rst to Markdown 2014-09-08 10:49:15 +03:00
Adrian Perez de Castro
00c3ca3730 Rename NEWS.rst to CHANGELOG.md
Follow the recommendations from http://keepachangelog.com/
2014-09-08 10:34:51 +03:00
Adrian Perez de Castro
3de8a4daca Release version 0.3.4 2014-09-03 14:21:04 +03:00
Adrian Perez
a2d30629ed Merge pull request #13 from anthonyryan1/master
Shift table styling details onto the client
2014-09-03 14:08:34 +03:00
Anthony Ryan
da3f7ea17d Shift table stlying details onto the client
There is almost universal support for the CSS3
:nth-child() pseudo-selector. We're shifting the
responsibility for labeling even and odd rows to
the browser.
2014-06-02 09:02:24 -04:00
Adrian Perez
b1eb0a4c44 Merge pull request #9 from quatauta/master
HTML template: Add meta viewport for mobile browsers
2014-01-04 07:09:14 -08:00
Daniel Schömer
a989003c62 template.h: viewport width for mobile browsers
Set html5 meta viewport width to device-width. A mobile browser now scales up the directory listing and dir-/filenames are easier to read and click/touch.
2013-12-28 17:58:35 +01:00
Daniel Schömer
dc2bb3a42b template.html: viewport width for mobile browsers
Set html5 meta viewport width to device-width. A mobile browser now scales up the directory listing and dir-/filenames are easier to read and click/touch.
2013-12-28 17:56:13 +01:00
Adrian Perez
47e36a788f Merge pull request #8 from polymorf/master
Add new line between parent dir and file/dir list
2013-11-15 01:57:10 -08:00
David BÉRARD
1b90ae6977 add new line between parent dir and file/dir list, each table row end now with a new line 2013-11-14 14:54:05 +01:00
Adrian Perez de Castro
87e4206159 Release version 0.3.3 2013-10-25 13:06:44 +03:00
Adrian Perez de Castro
ea30f7fb21 Preserve URL sorting arguments on directory links
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.
2013-10-25 13:00:10 +03:00
Adrian Perez de Castro
9b3cdb5583 Clickable table headers change sort direction
Make table headers clickable, for changing sorting direction of the entries.
Clicking on the name of the headers selects ascending direction, clicking on
the arrow next to it, chooses descending direction. The arrow symbol, for
simplicity, is an Unicode down-arrow symbol, which all reasonably modern
browsers should display fine. Also, most text-only browsers will show the
arrow correctly when running on Unicode-compatible terminals.
2013-10-25 12:21:33 +03:00
Adrian Perez de Castro
1226d363be Support changing the sort direction of elements
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.
2013-10-24 21:45:18 +03:00
Adrian Perez de Castro
d78536c9a4 Support sorting files using mtime or size
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.
2013-10-24 17:38:48 +03:00
Adrian Perez de Castro
fa6455a011 Release version 0.3.2 2013-06-05 11:43:25 +03:00
Adrian Perez de Castro
6cf0bf8ad8 Update copyright header 2013-06-05 11:38:34 +03:00
Adrian Perez
fd3950172a Merge pull request #4 from davidjb/master
Ensure correct 200 status is sent to clients on successful listing
2013-04-22 04:56:57 -07:00
David\ Beitey
aba75b3c45 Ensure fancyindex is sending NGX_HTTP_OK (200) as the status vs HTTP_OK which is 0. Without this, connections sit waiting forever. 2013-04-19 11:10:44 +10:00
Adrian Perez
2034d0ad35 Initialize headers_out.status to NGX_OK and improve error check
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.
2012-03-14 22:30:26 +02:00
Stefan Rubner
ea6323f92c Ooops. Didn't fix the actual check but just added the comment instead. Fixed. 2012-03-14 00:29:11 +01:00
Stefan Rubner
07614d5abe Fixed the wrong status code check when including header/footer in NGinx 1.1.16
where ngx_http_subrequests returns NGX_OK (0) and not NGX_HTTP_OK (200) on a
successful completion of the subrequest.
2012-03-08 23:49:32 +01:00
Adrian Perez
607159a61d Update README with some bits
More exactly:

* In the requirements section, state that the module will work with
  any version of Nginx newer than 0.7.x

* Updated URL to the Nginx wiki, using now wiki.nginx.org

* Specifying a custom CSS works, the README was contradicting the code.
  FWIW, removed status markers from features in the file.

* Made the build instructions a bit more generic.
2012-01-18 00:31:22 +02:00
Adrian Perez
44805008d0 Use "ngx_inline" instead of plain "inline"
This should improve compatibility with some particular compilers
2012-01-18 00:23:02 +02:00
Óscar García Amor
a86e293f4f - Fixed description errors in README.rst
- Now the directives are sorted alphabetically
2011-07-20 08:37:07 +02:00
Adrian Perez
42d2f1b1f7 Properly escape ':' and '?' in generated hrefs
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.
2011-04-04 03:46:51 +03:00
Adrian Perez
d8e0bdaef2 Update e-mail address and copyright headers 2011-04-03 00:22:59 +03:00
46 changed files with 2213 additions and 409 deletions

4
.gitattributes vendored Normal file
View file

@ -0,0 +1,4 @@
/.gitignore export-ignore
/.travis.yml export-ignore
/make-dist export-ignore
t/* text eol=lf

49
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,49 @@
---
name: Build
on: [pull_request]
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-18.04]
compiler: [gcc, clang]
nginx:
# Mainline
- 1.23.3
# Stable.
- 1.22.1
# First version with loadable module support.
- 1.9.15
# Oldest supported version.
- 0.8.55
dynamic: [0, 1]
exclude:
- nginx: 0.8.55
dynamic: 1
- nginx: 0.8.55
os: macos-latest
- compiler: gcc
os: macos-latest
runs-on: ${{ matrix.os }}
env:
CFLAGS: "-Wno-error"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Packages
run: |
case $RUNNER_OS in
Linux )
sudo apt update
sudo apt install -y libpcre3-dev libssl-dev
;;
* )
;;
esac
t/get-pup || echo 'Tests needing pup will be skipped'
- name: Test
env:
CC: ${{ matrix.compiler }}
run: t/build-and-run ${{ matrix.nginx }} ${{ matrix.dynamic }}

7
.gitignore vendored
View file

@ -1 +1,8 @@
*.sw[op]
/nginx-*
/t/*.sh
/t/*.out
/t/*.err
/t/pup*
/t/bug*/
/prefix/

42
.todo
View file

@ -1,42 +0,0 @@
<?xml version="1.0"?>
<todo version="0.1.20">
<note priority="medium" time="1187975642" done="1188304701">
readme:iframe
<comment>
done in r23
</comment>
</note>
<note priority="medium" time="1187975645" done="1244350191">
readme:div
<comment>
will not be done
</comment>
</note>
<note priority="medium" time="1187975648" done="1244350198">
readme:pre
<comment>
will not be done
</comment>
</note>
<note priority="medium" time="1187975662" done="1189593070">
header:inline
</note>
<note priority="medium" time="1187975708" done="1189593086">
footer:inline
</note>
<note priority="medium" time="1188484132" done="1244350207">
install handler *after* index handler
<comment>
done
</comment>
</note>
<note priority="medium" time="1188384488">
split big handler function into smaller pieces
</note>
<note priority="medium" time="1189426947" done="1244350211">
proper error message on subrequest errors
<comment>
done
</comment>
</note>
</todo>

199
CHANGELOG.md Normal file
View file

@ -0,0 +1,199 @@
# Change Log
All notable changes to this project will be documented in this file.
## [Unreleased]
## [0.5.2] - 2021-10-28
### Fixed
- Properly escape file names to ensure that file names are never renreded
as HTML. (Patch by Anthony Ryan <<anthonyryan1@gmail.com>>,
[#128](https://github.com/aperezdc/ngx-fancyindex/pull/128).)
## [0.5.1] - 2020-10-26
### Fixed
- Properly handle optional second argument to `fancyindex_header` and
`fancyindex_footer`
([#117](https://github.com/aperezdc/ngx-fancyindex/issues/117)).
## [0.5.0] - 2020-10-24
### Added
- New option `fancyindex_show_dotfiles`. (Path by Joshua Shaffer
<<joshua.shaffer@icmrl.net>>.)
- The `fancyindex_header` and `fancyindex_footer` options now support local
files properly, by means of a `local` flag. (Patches by JoungKyun Kim
<<joungkyun@gmail.com>> and Adrián Pérez <<aperez@igalia.com>>.)
### Changed
- Improved performance of directory entry sorting, which should be quite
noticeable for directories with thousands of files. (Patch by
[Yuxiang Zhang](https://github.com/z4yx).)
- The minimum Nginx version supported by the module is now 0.8.x.
### Fixed
- Properly escape square brackets in directory entry names when the module
is built with older versions of Nginx. (Patch by Adrián Pérez
<<aperez@igalia.com>>.)
- Fix directory entry listing not being shown when using the
[nginx-auth-ldap](https://github.com/kvspb/nginx-auth-ldap) module. (Patch
by JoungKyun Kim <<joungkyun@gmail.com>>.)
## [0.4.4] - 2020-02-19
### Added
- New option `fancyindex_hide_parent_dir`, which disables generating
links to parent directories in listings. (Patch by Kawai Ryota
<<admin@mail.kr-kp.com>>.)
### Changed
- Each table row is now separated by a new line (as a matter of fact,
a `CRLF` sequence), which makes it easier to parse output using simple
text tools. (Patch by Anders Trier <<anders.trier.olesen@gmail.com>>.)
- Some corrections and additions to the README file. (Patches by Nicolas
Carpi <<nicolas.carpi@curie.fr>> and David Beitey <<david@davidjb.com>>.)
### Fixed
- Use correct character references for `&` characters in table sorter URLs
within the template (Patch by David Beitey <<david@davidjb.com>>.)
- Properly encode filenames when used as URI components.
## [0.4.3] - 2018-07-03
### Added
- Table cells now have class names, which allows for better CSS styling.
(Patch by qjqqyy <<gyula@nyirfalvi.hu>>.)
- The test suite now can parse and check elements from the HTML returned
by the module, thanks to the [pup](https://github.com/EricChiang/pup)
tool.
### Fixed
- Sorting by file size now works correctly.
(Patch by qjqqyy <<gyula@nyirfalvi.hu>>.)
## [0.4.2] - 2017-08-19
### Changed
- Generated HTML from the default template is now proper HTML5, and it should
pass validation (#52).
- File sizes now have decimal positions when using `fancyindex_exact_size off`.
(Patch by Anders Trier <<anders.trier.olesen@gmail.com>>.)
- Multiple updates to `README.rst` (Patches by Danila Vershinin
<<ciapnz@gmail.com>>, Iulian Onofrei, Lilian Besson, and Nick Geoghegan
<<nick@nickgeoghegan.net>>.)
### Fixed
- Sorting by file size now also works correctly for directories which contain
files of sizes bigger than `INT_MAX`. (#74, fix suggestion by Chris Young.)
- Custom headers which fail to declare an UTF-8 encoding no longer cause table
header arrows to be rendered incorrectly by browsers (#50).
- Fix segmentation fault when opening directories with empty files (#61, patch
by Catgirl <<cat@wolfgirl.org>>.)
## [0.4.1] - 2016-08-18
### Added
- New `fancyindex_directories_first` configuration directive (enabled by
default), which allows setting whether directories are sorted before other
files. (Patch by Luke Zapart <<luke@zapart.org>>.)
### Fixed
- Fix index files not working when the fancyindex module is in use (#46).
## [0.4.0] - 2016-06-08
### Added
- The module can now be built as a [dynamic
module](https://www.nginx.com/resources/wiki/extending/converting/).
(Patch by Róbert Nagy <<vrnagy@gmail.com>>.)
- New configuration directive `fancyindex_show_path`, which allows hiding the
`<h1>` header which contains the current path.
(Patch by Thomas P. <<tpxp@live.fr>>.)
### Changed
- Directory and file links in listings now have a title="..." attribute.
(Patch by `@janglapuk` <<trusdi.agus@gmail.com>>.)
### Fixed
- Fix for hung requests when the module is used along with `ngx_pagespeed`.
(Patch by Otto van der Schaaf <<oschaaf@we-amp.com>>.)
## [0.3.6] - 2016-01-26
### Added
- New feature: Allow filtering out symbolic links using the
`fancyindex_hide_symlinks` configuration directive. (Idea and prototype
patch by Thomas Wemm.)
- New feature: Allow specifying the format of timestamps using the
`fancyindex_time_format` configuration directive. (Idea suggested by Xiao
Meng <<novoreorx@gmail.com>>).
### Changed
- Listings in top-level directories will not generate a "Parent Directory"
link as first element of the listing. (Patch by Thomas P.)
### Fixed
- Fix propagation and overriding of the `fancyindex_css_href` setting inside
nested locations.
- Minor changes in the code to allow building cleanly under Windows with
Visual Studio 2013. (Patch by Y. Yuan <<yzwduck@gmail.com>>).
## [0.3.5] - 2015-02-19
### Added
- New feature: Allow setting the default sort criterion using the
`fancyindex_default_sort` configuration directive. (Patch by
Алексей Урбанский).
- New feature: Allow changing the maximum length of file names, using
the `fancyindex_name_length` configuration directive. (Patch by
Martin Herkt).
### Changed
- Renames `NEWS.rst` to `CHANGELOG.md`, which follows the recommendations
from [Keep a Change Log](http://keepachangelog.com/).
- Configuring Nginx without the `http_addition_module` will generate a
warning during configuration, as it is needed for the `fancyindex_footer`
and `fancyindex_header` directives.
## [0.3.4] - 2014-09-03
### Added
- Viewport is now defined in the generated HTML, which works better
for mobile devices.
### Changed
- Even-odd row styling moved to the CSS using :nth-child(). This
makes the HTML served to clients smaller.
## [0.3.3] - 2013-10-25
### Added
- New feature: table headers in the default template are now clickable
to set the sorting criteria and direction of the index entries.
(https://github.com/aperezdc/ngx-fancyindex/issues/7)
## [0.3.2] - 2013-06-05
### Fixed
- Solved a bug that would leave certain clients stalled forever.
- Improved handling of subrequests for non-builtin headers/footers.
## [0.3.1] - 2011-04-04
### Added
- `NEWS.rst` file, to act as change log.
[Unreleased]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.5.2...HEAD
[0.5.2]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.5.1...v0.5.2
[0.5.1]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.5.0...v0.5.1
[0.5.0]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.4.4...v0.5.0
[0.4.4]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.4.3...v0.4.4
[0.4.3]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.4.2...v0.4.3
[0.4.2]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.4.1...v0.4.2
[0.4.1]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.4.0...v0.4.1
[0.4.0]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.3.6...v0.4.0
[0.3.6]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.3.5...v0.3.6
[0.3.5]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.3.4...v0.3.5
[0.3.4]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.3.3...v0.3.4
[0.3.3]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.3.2...v0.3.3
[0.3.2]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.3.1...v0.3.2
[0.3.1]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.3...v0.3.1

30
HACKING.md Normal file
View file

@ -0,0 +1,30 @@
# Fancy Index module Hacking HOW-TO
## How to modify the template
The template is in the `template.html` file. Note that comment markers are
used to control how the `template.awk` Awk script generates the C header
which gets ultimately included in the compiled object code. Comment markers
have the `<!-- var identifier -->` format. Here `identifier` must be
a valid C identifier. All the text following the marker until the next
marker will be flattened into a C string.
If the identifier is `NONE` (capitalized) the text from that marker up to
the next marker will be discarded.
## Regenerating the C header
You will need Awk. I hope any decent implementation will do, but the GNU one
is known to work flawlessly. Just do:
$ awk -f template.awk template.html > template.h
If your copy of `awk` is not the GNU implementation, you will need to
install it and use `gawk` instead in the command line above.
This includes macOS where the current built-in `awk` (currently version
20070501 at time of testing on 10.13.6) doesn't apply correctly and causes
characters to be omitted from the output. `gawk` can be installed with a
package manager such as [Homebrew](https://brew.sh) or
[MacPorts](https://ports.macports.org/port/gawk).

View file

@ -1,33 +0,0 @@
===================================
Fancy Index module Hacking HOW-TO
===================================
.. contents::
How to modify the template
==========================
The template is in the ``template.html`` file. Note that comment markers are
used to control how the ``template.awk`` Awk script generates the C header
which gets ultimately included in the compiled object code. Comment markers
have the ``<!-- var identifier -->`` format. Here ``identifier`` must be
a valid C identifier. All the text following the marker until the next
marker will be flattened into a C string.
If the identifier is ``NONE`` (capitalized) the text from that marker up to
the next marker will be discarded.
Regenerating the C header
~~~~~~~~~~~~~~~~~~~~~~~~~
You will need Awk. I hope any decent implementation will do, but the GNU one
is known to work flawlessly. Just do::
$ awk -f template.awk template.html > template.h
If your copy of ``awk`` is not the GNU implementation, you will need to
install it and use ``gawk`` instead in the command line above.
.. vim: spell spelllang=en expandtab

View file

@ -2,16 +2,22 @@
Nginx Fancy Index module
========================
.. image:: https://travis-ci.com/aperezdc/ngx-fancyindex.svg?branch=master
:target: https://travis-ci.com/aperezdc/ngx-fancyindex
:alt: Build Status
.. contents::
The Fancy Index module makes possible the generation of file listings, like
the built-in `autoindex <http://wiki.codemongers.com/NginxHttpAutoindexModule>`__
the built-in `autoindex <http://wiki.nginx.org/NginxHttpAutoindexModule>`__
module does, but adding a touch of style. This is possible because the module
module allows a certain degree of customization of the generated content:
allows a certain degree of customization of the generated content:
* Custom headers. Either local or stored remotely (*working*).
* Custom footers. Either local or stored remotely (*working*).
* Add you own CSS style rules (*not yet implemented*).
* Custom headers, either local or stored remotely.
* Custom footers, either local or stored remotely.
* Add your own CSS style rules.
* Allow choosing to sort elements by name (default), modification time, or
size; both ascending (default), or descending.
This module is designed to work with Nginx_, a high performance open source web
server written by `Igor Sysoev <http://sysoev.ru>`__.
@ -19,13 +25,37 @@ server written by `Igor Sysoev <http://sysoev.ru>`__.
Requirements
============
* Sources for Nginx_ 0.8.x, and its requirements.
- The module compiles with 0.7.x versions as well.
CentOS, RHEL, Fedora Linux
~~~~~~~~~~~~~~~~~~~~~~~~~~
- It _might_ compile with 0.6.x applying "nginx-0.6-support.patch", YMMV.
For users of the `official stable <https://www.nginx.com/resources/wiki/start/topics/tutorials/install/>`__ Nginx repository, `extra packages repository with dynamic modules <https://www.getpagespeed.com/redhat>`__ is available and fancyindex is included.
* Patience, and some Coffee™.
Install repository configuration, then the module package::
yum -y install https://extras.getpagespeed.com/release-latest.rpm
yum -y install nginx-module-fancyindex
Then load the module in `/etc/nginx/nginx.conf` using::
load_module "modules/ngx_http_fancyindex_module.so";
macOS
~~~~~
Users can `install Nginx on macOS with MacPorts <https://ports.macports.org/port/nginx>`__; fancyindex is included::
sudo port install nginx
Other platforms
~~~~~~~~~~~~~~~
In most other cases you will need the sources for Nginx_. Any version starting
from the 0.8 series should work.
In order to use the ``fancyindex_header_`` and ``fancyindex_footer_`` directives
you will also need the `ngx_http_addition_module <https://nginx.org/en/docs/http/ngx_http_addition_module.html>`_
built into Nginx.
Building
@ -44,8 +74,15 @@ Building
``--add-module`` flag pointing to the directory which contains the source
of the fancy indexing module::
$ cd nginx-0.6.6
$ ./configure --add-module=../nginx-fancyindex-?.?.? [extra desired options]
$ cd nginx-?.?.?
$ ./configure --add-module=../nginx-fancyindex-?.?.? \
[--with-http_addition_module] [extra desired options]
Since version 0.4.0, the module can also be built as a
`dynamic module <https://www.nginx.com/resources/wiki/extending/converting/>`_,
using ``--add-dynamic-module=…`` instead and
``load_module "modules/ngx_http_fancyindex_module.so";``
in the configuration file
4. Build and install the software::
@ -70,6 +107,26 @@ a ``server`` section in your Nginx_ configuration file::
}
Themes
~~~~~~
The following themes demonstrate the level of customization which can be
achieved using the module:
* `Theme <https://github.com/TheInsomniac/Nginx-Fancyindex-Theme>`__ by
`@TheInsomniac <https://github.com/TheInsomniac>`__. Uses custom header and
footer.
* `Theme <https://github.com/Naereen/Nginx-Fancyindex-Theme>`__ by
`@Naereen <https://github.com/Naereen/>`__. Uses custom header and footer. The
header includes a search field to filter by file name using JavaScript.
* `Theme <https://github.com/fraoustin/Nginx-Fancyindex-Theme>`__ by
`@fraoustin <https://github.com/fraoustin>`__. Responsive theme using
Material Design elements.
* `Theme <https://github.com/alehaa/nginx-fancyindex-flat-theme>`__ by
`@alehaa <https://github.com/alehaa>`__. Simple, flat theme based on
Bootstrap 4 and FontAwesome.
Directives
==========
@ -81,51 +138,31 @@ fancyindex
:Description:
Enables or disables fancy directory indexes.
fancyindex_localtime
~~~~~~~~~~~~~~~~~~~~
:Syntax: *fancyindex_localtime* [*on* | *off*]
:Default: fancyindex_localtime off
fancyindex_default_sort
~~~~~~~~~~~~~~~~~~~~~~~
:Syntax: *fancyindex_default_sort* [*name* | *size* | *date* | *name_desc* | *size_desc* | *date_desc*]
:Default: fancyindex_default_sort name
:Context: http, server, location
:Description:
Defines how to represent file sizes in the directory listing; either
accurately, or rounding off to the kilobyte, the megabyte and the
gigabyte.
Defines sorting criterion by default.
fancyindex_exact_size
~~~~~~~~~~~~~~~~~~~~~
:Syntax: *fancyindex_exact_size* [*on* | *off*]
:Default: fancyindex_exact_size on
fancyindex_case_sensitive
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Syntax: *fancyindex_case_sensitive* [*on* | *off*]
:Default: fancyindex_case_sensitive on
:Context: http, server, location
:Description:
Enables showing file times as local time. Default is “off” (GMT time).
If enabled (default setting), sorting by name will be case-sensitive.
If disabled, case will be ignored when sorting by name.
fancyindex_header
~~~~~~~~~~~~~~~~~
:Syntax: *fancyindex_header path*
:Default: fancyindex_header ""
fancyindex_directories_first
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Syntax: *fancyindex_directories_first* [*on* | *off*]
:Default: fancyindex_directories_first on
:Context: http, server, location
:Description:
Specifies which file should be inserted at the head of directory listings.
If set to an empty string, the default header supplied by the module will
be sent.
fancyindex_footer
~~~~~~~~~~~~~~~~~
:Syntax: *fancyindex_footer path*
:Default: fancyindex_footer ""
:Context: http, server, location
:Description:
Specifies which file should be inserted at the foot of directory listings.
If set to an empty string, the default footer supplied by the module will
be sent.
.. warning:: When inserting custom header/footer a subrequest will be
issued so potentially any URL can be used as source for them. Although it
will work with external URLs, only using internal ones is supported.
External URLs are totally untested and using them will make Nginx_ block
while waiting for the subrequest to complete. If you feel like external
header/footer is a must-have for you, please
`let me know <mailto:aperez@connectical.com>`__.
If enabled (default setting), groups directories together and sorts them
before all regular files. If disabled, directories are sorted together with files.
fancyindex_css_href
~~~~~~~~~~~~~~~~~~~
@ -138,17 +175,150 @@ fancyindex_css_href
The link is inserted after the built-in CSS rules, so you can override the
default styles.
fancyindex_exact_size
~~~~~~~~~~~~~~~~~~~~~
:Syntax: *fancyindex_exact_size* [*on* | *off*]
:Default: fancyindex_exact_size on
:Context: http, server, location
:Description:
Defines how to represent file sizes in the directory listing: either
accurately, or rounding off to the kilobyte, the megabyte and the
gigabyte.
fancyindex_footer
~~~~~~~~~~~~~~~~~
:Syntax: *fancyindex_footer path* [*subrequest* | *local*]
:Default: fancyindex_footer ""
:Context: http, server, location
:Description:
Specifies which file should be inserted at the foot of directory listings.
If set to an empty string, the default footer supplied by the module will
be sent. The optional parameter indicates whether the *path* is to be
treated as a URI to load using a *subrequest* (the default), or whether
it refers to a *local* file.
.. note:: Using this directive needs the ngx_http_addition_module_ built
into Nginx.
.. warning:: When inserting custom a header/footer, a subrequest will be
issued so potentially any URL can be used as source for them. Although it
will work with external URLs, only using internal ones is supported.
External URLs are totally untested and using them will make Nginx_ block
while waiting for the subrequest to complete. If you feel like external
header/footer is a must-have for you, please
`let me know <mailto:aperez@igalia.com>`__.
fancyindex_header
~~~~~~~~~~~~~~~~~
:Syntax: *fancyindex_header path* [*subrequest* | *local*]
:Default: fancyindex_header ""
:Context: http, server, location
:Description:
Specifies which file should be inserted at the head of directory listings.
If set to an empty string, the default header supplied by the module will
be sent. The optional parameter indicates whether the *path* is to be
treated as a URI to load using a *subrequest* (the default), or whether
it refers to a *local* file.
.. note:: Using this directive needs the ngx_http_addition_module_ built
into Nginx.
fancyindex_show_path
~~~~~~~~~~~~~~~~~~~~
:Syntax: *fancyindex_show_path* [*on* | *off*]
:Default: fancyindex_show_path on
:Context: http, server, location
:Description:
Whether or not to output the path and the closing </h1> tag after the header.
This is useful when you want to handle the path displaying with a PHP script
for example.
.. warning:: This directive can be turned off only if a custom header is provided
using fancyindex_header.
fancyindex_show_dotfiles
~~~~~~~~~~~~~~~~~~~~
:Syntax: *fancyindex_show_dotfiles* [*on* | *off*]
:Default: fancyindex_show_dotfiles off
:Context: http, server, location
:Description:
Whether to list files that are preceded with a dot. Normal convention is to
hide these.
fancyindex_ignore
~~~~~~~~~~~~~~~~~
:Syntax: *fancyindex_ignore string1 [string2 [... stringN]]*
:Default: No default.
:Context: http, server, location
:Description:
Specifies a list of file names which will be not be shown in generated
listings. If Nginx was built with PCRE support strings are interpreted as
Specifies a list of file names which will not be shown in generated
listings. If Nginx was built with PCRE support, strings are interpreted as
regular expressions.
.. _nginx: http://nginx.net
fancyindex_hide_symlinks
~~~~~~~~~~~~~~~~~~~~~~~~
:Syntax: *fancyindex_hide_symlinks* [*on* | *off*]
:Default: fancyindex_hide_symlinks off
:Context: http, server, location
:Description:
When enabled, generated listings will not contain symbolic links.
fancyindex_hide_parent_dir
~~~~~~~~~~~~~~~~~~~~~~~~
:Syntax: *fancyindex_hide_parent_dir* [*on* | *off*]
:Default: fancyindex_hide_parent_dir off
:Context: http, server, location
:Description:
When enabled, it will not show the parent directory.
fancyindex_localtime
~~~~~~~~~~~~~~~~~~~~
:Syntax: *fancyindex_localtime* [*on* | *off*]
:Default: fancyindex_localtime off
:Context: http, server, location
:Description:
Enables showing file times as local time. Default is “off” (GMT time).
fancyindex_time_format
~~~~~~~~~~~~~~~~~~~~~~
:Syntax: *fancyindex_time_format* string
:Default: fancyindex_time_format "%Y-%b-%d %H:%M"
:Context: http, server, location
:Description:
Format string used for timestamps. The format specifiers are a subset of
those supported by the `strftime <https://linux.die.net/man/3/strftime>`_
function, and the behavior is locale-independent (for example, day and month
names are always in English). The supported formats are:
* ``%a``: Abbreviated name of the day of the week.
* ``%A``: Full name of the day of the week.
* ``%b``: Abbreviated month name.
* ``%B``: Full month name.
* ``%d``: Day of the month as a decimal number (range 01 to 31).
* ``%e``: Like ``%d``, the day of the month as a decimal number, but a
leading zero is replaced by a space.
* ``%F``: Equivalent to ``%Y-%m-%d`` (the ISO 8601 date format).
* ``%H``: Hour as a decimal number using a 24-hour clock (range 00
to 23).
* ``%I``: Hour as a decimal number using a 12-hour clock (range 01 to 12).
* ``%k``: Hour (24-hour clock) as a decimal number (range 0 to 23);
single digits are preceded by a blank.
* ``%l``: Hour (12-hour clock) as a decimal number (range 1 to 12); single
digits are preceded by a blank.
* ``%m``: Month as a decimal number (range 01 to 12).
* ``%M``: Minute as a decimal number (range 00 to 59).
* ``%p``: Either "AM" or "PM" according to the given time value.
* ``%P``: Like ``%p`` but in lowercase: "am" or "pm".
* ``%r``: Time in a.m. or p.m. notation. Equivalent to ``%I:%M:%S %p``.
* ``%R``: Time in 24-hour notation (``%H:%M``).
* ``%S``: Second as a decimal number (range 00 to 60).
* ``%T``: Time in 24-hour notation (``%H:%M:%S``).
* ``%u``: Day of the week as a decimal, range 1 to 7, Monday being 1.
* ``%w``: Day of the week as a decimal, range 0 to 6, Monday being 0.
* ``%y``: Year as a decimal number without a century (range 00 to 99).
* ``%Y``: Year as a decimal number including the century.
.. _nginx: https://nginx.org
.. vim:ft=rst:spell:spelllang=en:

20
config
View file

@ -1,8 +1,20 @@
# vim:ft=sh:
ngx_addon_name=ngx_http_fancyindex_module
# XXX: Insert fancyindex module *after* index module!
#
HTTP_MODULES=`echo "${HTTP_MODULES}" | sed -e \
if [ "$ngx_module_link" = DYNAMIC ] ; then
ngx_module_type=HTTP
ngx_module_name=ngx_http_fancyindex_module
ngx_module_srcs="$ngx_addon_dir/ngx_http_fancyindex_module.c"
ngx_module_deps="$ngx_addon_dir/template.h"
ngx_module_order="$ngx_module_name ngx_http_autoindex_module"
. auto/module
else
# XXX: Insert fancyindex module *after* index module!
#
HTTP_MODULES=`echo "${HTTP_MODULES}" | sed -e \
's/ngx_http_index_module/ngx_http_fancyindex_module ngx_http_index_module/'`
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_fancyindex_module.c"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_fancyindex_module.c"
if [ $HTTP_ADDITION != YES ] ; then
echo " - The 'addition' filter is needed for fancyindex_{header,footer}, but it was disabled"
fi
fi

10
make-dist Executable file
View file

@ -0,0 +1,10 @@
#! /bin/sh
set -e
GIT_TAG=$(git describe --tags HEAD)
VERSION=${GIT_TAG#v}
PV="ngx-fancyindex-${VERSION}"
set -x
git archive --worktree-attributes --prefix="${PV}/" -o "${PV}.tar" "${GIT_TAG}"
xz -f9 "${PV}.tar"

View file

@ -1,23 +0,0 @@
=== modified file 'ngx_http_fancyindex_module.c'
--- ngx_http_fancyindex_module.c 2008-09-11 17:55:52 +0000
+++ ngx_http_fancyindex_module.c 2008-12-10 01:33:43 +0000
@@ -383,7 +383,7 @@
entry->mtime = ngx_de_mtime(&dir);
entry->size = ngx_de_size(&dir);
entry->utf_len = (r->utf8)
- ? ngx_utf8_length(entry->name.data, entry->name.len)
+ ? ngx_utf_length(entry->name.data, entry->name.len)
: len;
}
@@ -478,8 +478,7 @@
copy = NGX_HTTP_FANCYINDEX_NAME_LEN + 1;
}
- b->last = ngx_utf8_cpystrn(b->last, entry[i].name.data,
- copy, entry[i].name.len);
+ b->last = ngx_utf_cpystrn(b->last, entry[i].name.data, copy);
last = b->last;
} else {

File diff suppressed because it is too large Load diff

22
t/00-build-artifacts.test Normal file
View file

@ -0,0 +1,22 @@
#! /bin/bash
cat <<---
This test checks that the built Nginx either has the dynamic fancyindex
module available, or that it's not there (for static builds).
--
readonly nginx_path="${PREFIX}/sbin/nginx"
readonly so_path="${PREFIX}/modules/ngx_http_fancyindex_module.so"
if [[ ! -x ${nginx_path} ]] ; then
fail "executable binary not found at '%s'\n" "${nginx_path}"
fi
if ${DYNAMIC} ; then
if [[ ! -r ${so_path} ]] ; then
fail "module not found at '%s'\n" "${so_path}"
fi
else
if [[ -r ${so_path} ]] ; then
fail "module should not exist at '%s'\n" "${so_path}"
fi
fi

7
t/01-smoke-hasindex.test Normal file
View file

@ -0,0 +1,7 @@
#! /bin/bash
cat <<---
This test fetches the root directory served by Nginx, which has no index file,
and checks that the output contains something that resembles a directory index.
--
nginx_start
grep 'Index of' <( fetch )

View file

@ -0,0 +1,11 @@
#! /bin/bash
cat <<---
This test fetches the root directory served by Nginx, which has no index file,
and checks that the output contains something that resembles the output from
the fancyindex module.
--
nginx_start
content=$(fetch --with-headers)
grep 'Index of /' <<< "${content}" # It is an index
grep '<table\>' <<< "${content}" # It contains a table
grep '^ Content-Type:[[:space:]]*text/html' <<< "${content}"

9
t/03-exact_size_off.test Normal file
View file

@ -0,0 +1,9 @@
#! /bin/bash
cat <<---
This test checks if the output from using "fancyindex_exact_size off"
looks sane.
--
nginx_start 'fancyindex_exact_size off;'
content=$(fetch)
grep -e '[1-9]\.[0-9] KiB' <<< "${content}"
grep -E '[0-9]+ B' <<< "${content}"

24
t/04-hasindex-html.test Normal file
View file

@ -0,0 +1,24 @@
#! /bin/bash
cat <<---
This test fetches the root directory served by Nginx, which has no index
file, and checks that the output contains a few HTML elements known to
exist in a directory index.
--
use pup
nginx_start
content=$( fetch )
# Check page title
[[ $(pup -p title text{} <<< "${content}") = 'Index of /' ]]
# Check table headers
[[ $(pup -n body table thead th a:first-child <<< "${content}") -eq 3 ]]
{
read -r name_label
read -r size_label
read -r date_label
} < <( pup -p body table thead th a:first-child text{} <<< "${content}" )
[[ ${name_label} = File\ Name ]]
[[ ${size_label} = File\ Size ]]
[[ ${date_label} = Date ]]

36
t/05-sort-by-size.test Normal file
View file

@ -0,0 +1,36 @@
#! /bin/bash
cat <<---
This test validates that the sorting by file size works.
--
use pup
nginx_start
# Ascending sort.
previous=''
while read -r size ; do
if [[ ${size} = - ]] ; then
continue
fi
if [[ -z ${previous} ]] ; then
previous=${size}
continue
fi
[[ ${previous} -le ${size} ]] || fail \
'Size %d should be smaller than %d\n' "${previous}" "${size}"
done < <( fetch '/?C=S&O=A' \
| pup -p body table tbody 'td:nth-child(2)' text{} )
# Descending sort.
previous=''
while read -r size ; do
if [[ ${size} = - ]] ; then
continue
fi
if [[ -z ${previous} ]] ; then
previous=${size}
continue
fi
[[ ${previous} -ge ${size} ]] || fail \
'Size %d should be greater than %d\n' "${previous}" "${size}"
done < <( fetch '/?C=S&O=D' \
| pup -p body table tbody 'td:nth-child(2)' text{} )

23
t/06-hide_parent.test Normal file
View file

@ -0,0 +1,23 @@
#! /bin/bash
cat <<---
This test checks the output using "fancyindex_hide_parent_dir on".
--
use pup
nginx_start 'fancyindex_hide_parent_dir on;'
content=$( fetch /child-directory/ )
# Check page title
[[ $(pup -p title text{} <<< "${content}") = "Index of /child-directory/" ]]
# Check table headers
[[ $(pup -n body table tbody tr:first-child td <<< "${content}") -eq 3 ]]
{
read -r name_label
read -r size_label
read -r date_label
} < <( pup -p body table tbody tr:first-child td text{} <<< "${content}" )
[[ ${name_label} != Parent\ Directory/ ]]
[[ ${name_label} = empty-file.txt ]]
[[ ${size_label} != - ]]
[[ ${date_label} != - ]]

50
t/07-directory-first.test Normal file
View file

@ -0,0 +1,50 @@
#! /bin/bash
cat <<---
This test checks the output using "fancyindex_directories_first on".
--
use pup
for d in "008d" "000d" "004d" ; do
mkdir -p "${TESTDIR}/dir_first/${d}"
done
for f in "005f" "001f" "003f"; do
touch "${TESTDIR}/dir_first/${f}"
done
for d in "006d" "002d" ; do
mkdir -p "${TESTDIR}/dir_first/${d}"
done
nginx_start 'fancyindex_directories_first on;'
previous=''
cur_type=''
while read -r name ; do
case "$name" in
*Parent*)
;;
*d*)
echo "dir $name"
[[ "$cur_type" = f ]] && fail 'Directories should come before files'
cur_type=d
if [[ -z ${previous} ]] ; then
previous=${name}
else
[[ ${previous} < ${name} ]] || fail \
'Name %s should come before %s\n' "${previous}" "${name}"
fi
;;
*f*)
echo "file $name"
[[ -z "$cur_type" ]] && fail 'Directories should come before files'
if [[ "$cur_type" = d ]] ; then
cur_type=f
previous=${name}
else
[[ ${previous} < ${name} ]] || fail \
'Name %s should come before %s\n' "${previous}" "${name}"
fi
;;
esac
done < <( fetch '/dir_first/' \
| pup -p body table tbody 'td:nth-child(1)' text{} )
nginx_is_running || fail "Nginx died"

21
t/07-show_dotfiles.test Normal file
View file

@ -0,0 +1,21 @@
#! /bin/bash
cat <<---
This test checks the option to show dotfiles.
--
# Turn it on.
nginx_start 'fancyindex_show_dotfiles on;'
on_content=$(fetch /show_dotfiles/)
nginx_stop
if [ $(grep '.okay' <<< "${on_content}") -ne 0 ] ; then
exit 1
fi
# Turn it off.
nginx_start
off_content=$(fetch /show_dotfiles/)
nginx_stop
if [ $(grep '.okay' <<< "${on_content}") -eq 0] ; then
exit 1
fi
exit 0

17
t/08-local-footer.test Normal file
View file

@ -0,0 +1,17 @@
#! /bin/bash
cat <<---
This test checks that a local footer can be included with
"fancyindex_header ... local".
--
use pup
cat > "${TESTDIR}/footer" <<EOF
<div id="customfooter">yes</div>
EOF
nginx_start "fancyindex_footer \"${TESTDIR}/footer\" local;"
T=$(fetch / | pup -p body 'div#customfooter' text{})
[[ $T == yes ]] || fail 'Custom header missing'
nginx_is_running || fail 'Nginx died'

17
t/09-local-header.test Normal file
View file

@ -0,0 +1,17 @@
#! /bin/bash
cat <<---
This test checks that a local header can be included with
"fancyindex_header ... local".
--
use pup
cat > "${TESTDIR}/header" <<EOF
<div id="customheader">yes</div>
EOF
nginx_start "fancyindex_header \"${TESTDIR}/header\" local;"
T=$(fetch / | pup -p body 'div#customheader' text{})
[[ $T == yes ]] || fail 'Custom header missing'
nginx_is_running || fail 'Nginx died'

View file

@ -0,0 +1,26 @@
#! /bin/bash
cat <<---
This test checks that both a local header and footer can be included with
"fancyindex_{header,footer} ... local".
--
use pup
cat > "${TESTDIR}/header" <<EOF
<div id="customheader">yes</div>
EOF
cat > "${TESTDIR}/footer" <<EOF
<div id="customfooter">yes</div>
EOF
nginx_start "fancyindex_header \"${TESTDIR}/header\" local;
fancyindex_footer \"${TESTDIR}/footer\" local;"
P=$(fetch /)
H=$(pup -p body 'div#customheader' text{} <<< "$P")
[[ $H == yes ]] || fail 'Custom header missing'
F=$(pup -p body 'div#customfooter' text{} <<< "$P")
[[ $F == yes ]] || fail 'Custom footer missing'
nginx_is_running || fail 'Nginx died'

View file

@ -0,0 +1,31 @@
#! /bin/bash
cat <<---
This test checks that local footers are correctly included in the presence of
directives in nested locations:
fancyindex_footer <one> local;
location /sub {
fancyindex_footer <another> local;
}
--
use pup
echo '<div id="topfooter">yes</div>' > "${TESTDIR}/top-footer"
echo '<div id="subfooter">yes</div>' > "${TESTDIR}/sub-footer"
nginx_start "fancyindex_footer \"${TESTDIR}/top-footer\" local;
location /child-directory {
fancyindex_footer \"${TESTDIR}/sub-footer\" local;
}"
T=$(fetch /)
echo "$T" > "$TESTDIR/top.html"
[[ $(pup -p body 'div#topfooter' text{} <<< "$T") = yes ]] || fail 'Custom header missing at /'
[[ -z $(pup -p body 'div#subfooter' text{} <<< "$T") ]] || fail 'Wrong header at /'
T=$(fetch /child-directory/)
[[ $(pup -p body 'div#subfooter' text{} <<< "$T") = yes ]] || fail 'Custom header missing at /sub/'
[[ -z $(pup -p body 'div#topfooter' text{} <<< "$T") ]] || fail 'Wrong header at /sub/'
nginx_is_running || fail 'Nginx died'

View file

@ -0,0 +1,11 @@
#! /bin/bash
cat <<---
This test checks that the configuration file is properly parsed if there
is only one parameter passed to the fancyindex_header and fancyindex_footer
configuration directives.
--
nginx_start 'fancyindex_header "/header";
fancyindex_footer "/footer";'
nginx_is_running || fail 'Nginx died'

View file

@ -0,0 +1,9 @@
#! /bin/bash
cat <<---
Bug #107: 404 is returned when indexing filesystem root
https://github.com/aperezdc/ngx-fancyindex/issues/107
--
nginx_start 'root /;'
content=$(fetch)
grep 'Index of /' <<< "${content}" # It is an index
grep '<table\>' <<< "${content}" # It contains a table

View file

@ -0,0 +1,27 @@
#! /bin/bash
cat <<---
Check whether the Saturday long day name is available.
https://github.com/aperezdc/ngx-fancyindex/issues/157
--
use pup
nginx_start 'fancyindex_time_format "%A"; fancyindex_default_sort date;'
mkdir -p "${TESTDIR}/weekdays"
for (( i=2 ; i <= 8 ; i++ )) ; do
TZ=UTC touch -d "2023-01-0${i}T06:00:00" "${TESTDIR}/weekdays/day$i.txt"
done
ls "${TESTDIR}/weekdays"
content=$(fetch /weekdays/)
# We need row+1 because the first one is the table header.
dayname=$(pup -p body table tbody \
'tr:nth-child(7)' 'td:nth-child(3)' 'text{}' \
<<< "$content")
[[ $dayname = Saturday ]] || fail 'Sixth day is not Saturday'
dayname=$(pup -p body table tbody \
'tr:nth-child(8)' 'td:nth-child(3)' 'text{}' \
<<< "$content")
[[ $dayname = Sunday ]] || fail 'Seventh day is not Sunday'
nginx_is_running || fail 'Nginx died'

View file

@ -0,0 +1,16 @@
#! /bin/bash
cat <<---
Bug #61: Listing a directory with an empty file crashes Nginx
https://github.com/aperezdc/ngx-fancyindex/issues/61
--
# Prepare an empty directory with an empty file
mkdir -p "${TESTDIR}/bug61"
touch "${TESTDIR}/bug61/bug61.txt"
nginx_start 'fancyindex_exact_size off;'
content=$(fetch /bug61/)
test -n "${content}" || fail "Empty response"
echo "Response:"
echo "${content}"
nginx_is_running || fail "Nginx died"

View file

@ -0,0 +1,8 @@
#! /bin/bash
cat <<---
This test checks that case-insensitive sorting works.
--
nginx_start 'fancyindex_case_sensitive off;'
content=$(fetch /case-sensitivity/)
grep -A 999 '\<alice\>' <<< "${content}" | grep '\<Bob\>' # Bob is after alice

View file

@ -0,0 +1,8 @@
#! /bin/bash
cat <<---
This test checks that case-sensitive sorting works.
--
nginx_start 'fancyindex_case_sensitive on;'
content=$(fetch /case-sensitivity/)
grep -A 999 '\<Bob\>' <<< "${content}" | grep '\<alice\>' # alice is after Bob

View file

@ -0,0 +1,19 @@
#! /bin/bash
cat <<---
Bug #95: FancyIndex does not encode square brackets
https://github.com/aperezdc/ngx-fancyindex/issues/95
--
use pup
# Prepare a directory with a file that contains square brackets in the name.
mkdir -p "${TESTDIR}/bug95"
touch "${TESTDIR}"/bug95/'bug[95].txt'
nginx_start
content=$(fetch /bug95/)
test -n "${content}" || fail 'Empty response'
expected_href='bug%5B95%5D.txt'
obtained_href=$(pup -p body tbody 'tr:nth-child(2)' a 'attr{href}' <<< "${content}")
test "${expected_href}" = "${obtained_href}" || \
fail 'Expected: %s - Obtained: %s' "${expected_href}" "${obtained_href}"

36
t/build-and-run Executable file
View file

@ -0,0 +1,36 @@
#! /bin/bash
set -e
if [[ $# -lt 1 || $# -gt 2 ]] ; then
echo "Usage: $0 <nginx-version> [1]" 1>&2
exit 1
fi
readonly NGINX=$1
if [[ $2 -eq 1 ]] ; then
readonly DYNAMIC=$2
fi
case $(uname -s) in
Darwin)
JOBS=$(sysctl -n hw.activecpu)
;;
*)
JOBS=1
;;
esac
cd "$(dirname "$0")/.."
wget -O - http://nginx.org/download/nginx-${NGINX}.tar.gz | tar -xzf -
rm -rf prefix/
cd nginx-${NGINX}
./configure \
--add-${DYNAMIC:+dynamic-}module=.. \
--with-http_addition_module \
--without-http_rewrite_module \
--prefix="$(pwd)/../prefix"
make -j"$JOBS"
make install
cd ..
exec ./t/run prefix ${DYNAMIC}

0
t/case-sensitivity/Bob Normal file
View file

0
t/case-sensitivity/alice Normal file
View file

View file

105
t/get-pup Executable file
View file

@ -0,0 +1,105 @@
#! /bin/bash
set -e
declare -r SHASUMS='\
ec9522193516ad49c78d40a8163f1d92e98866892a11aadb7be584a975026a8a pup_69c02e189c2aaed331061ee436c39e72b830ef32_darwin_amd64.xz
75c27caa0008a9cc639beb7506077ad9f32facbffcc4e815e999eaf9588a527e pup_v0.4.0_darwin_386.zip
c539a697efee2f8e56614a54cb3b215338e00de1f6a7c2fa93144ab6e1db8ebe pup_v0.4.0_darwin_amd64.zip
259eee82c7d7d766f1b8f93a382be21dcfefebc855a9ce8124fd78717f9df439 pup_v0.4.0_dragonfly_amd64.zip
ba0fe5e87a24cab818e5d2efdd7540714ddfb1b7246600135915c666fdf1a601 pup_v0.4.0_freebsd_386.zip
1838ef84ec1f961e8009d19a4d1e6a23b926ee315da3d60c08878f3d69af5692 pup_v0.4.0_freebsd_amd64.zip
6886a9c60a912a810d012610bc3f784f0417999ff7d7df833a0695b9af60395b pup_v0.4.0_freebsd_arm.zip
e486b32ca07552cd3aa713cbf2f9d1b6e210ddb51d34b3090c7643f465828057 pup_v0.4.0_linux_386.zip
ec3d29e9fb375b87ac492c8b546ad6be84b0c0b49dab7ff4c6b582eac71ba01c pup_v0.4.0_linux_amd64.zip
c09b669fa8240f4f869dee7d34ee3c7ea620a0280cee1ea7d559593bcdd062c9 pup_v0.4.0_linux_arm64.zip
ebf70b3c76c02e0202c94af7ef06dcb3ecc866d1b9b84453d43fe01fa5dd5870 pup_v0.4.0_linux_arm.zip
a98a4d1f3c3a103e8ebe1a7aba9cb9d3cb045003208ca6f5f3d54889a225f267 pup_v0.4.0_linux_mips64le.zip
8e471cf6cfa118b2497bb3f42a7a48c52d0096107f748f37216855c8ab94f8e5 pup_v0.4.0_linux_mips64.zip
cfda9375eba65f710e052b1b59893c228c3fc92b0510756bb3f02c25938eee30 pup_v0.4.0_linux_ppc64le.zip
91a1e07ffb2c373d6053252e4de732f5db78c8eace49c6e1a0ef52402ecdf56c pup_v0.4.0_linux_ppc64.zip
fdc9b28a3daac5ad096023e1647292a7eccea6d9b1686f871307dae9f3bd064f pup_v0.4.0_nacl_386.zip
c8d3c9b56783bd5a55446f4580e1835606b2b945da2d1417ed509c5927a5f8bc pup_v0.4.0_nacl_amd64p32.zip
48c068c4353672528c8c3447a536208b0719f1e6d0f8fab8416b38b63ad0c1d9 pup_v0.4.0_nacl_arm.zip
7a27497b2f0be95c51bb2cbc25da12efba682c4f766bc5abc5742e9fc8d1eeb0 pup_v0.4.0_netbsd_386.zip
71a1808eb1b6442aa45d1de9e1c4fca543b2754c1aff5ba3d62b3456f9519691 pup_v0.4.0_netbsd_amd64.zip
928e6691b11c68ae3f28826848a13dc5c1c9673848fe7cf7f80dd76c9fb6e8a6 pup_v0.4.0_netbsd_arm.zip
5aca20a9b3264d2fde5a8d32f213c434edf9570ee6fae18953b8fff09d2976e2 pup_v0.4.0_openbsd_386.zip
e965c6f04b897240d84c60e2c18226deb231a657c5583680f58a61051ff5a100 pup_v0.4.0_openbsd_amd64.zip
30bc88a1e06606f4f3449af9fbf586f97c2e958677460a72bb1a168f67c4911c pup_v0.4.0_openbsd_arm.zip
9d50decf4572292f187cfec84660648d648336bc6109e1f032b1699ba1d28549 pup_v0.4.0_plan9_386.zip
1b2a6bd2388ddd691ca429497d88b2b047ec8dfb7bce9436925cb2f30632bf8e pup_v0.4.0_plan9_amd64.zip
0835de9c10a9e2b3b958b82d148da49eaafc695fe4a018cbaf7bb861b455583f pup_v0.4.0_solaris_amd64.zip
01acae220b69fb1ba8477d0e7f4d7669ef5de147966dc819cf75a845af74c5f3 pup_v0.4.0_windows_386.zip
6755cbd43e94eaf173689e93e914c7056a2249c2977e5b90024fb397f9b45ba4 pup_v0.4.0_windows_amd64.zip
'
declare -r TDIR=$(dirname "$0")
case $(uname -m) in
x86_64 | amd64 ) ARCH=amd64 ;;
i[3456]86 ) ARCH=386 ;;
* ) ARCH= ;;
esac
OS=$(uname -s | tr 'A-Z' 'a-z')
case ${OS} in
linux | freebsd | openbsd | netbsd | darwin ) ;;
* ) OS= ;;
esac
# The binary of pup 0.4.0 for macOS provided by the original project
# crashes immediately on macOS 10.13 (Darwin 17) and up so use a fork:
# https://github.com/ericchiang/pup/issues/85
if [[ ${OS} = darwin && $(uname -r | cut -d. -f1) -ge 17 ]] ; then
USE_FORK=1
else
USE_FORK=0
fi
if (( USE_FORK )) ; then
declare -r VERSION=69c02e189c2aaed331061ee436c39e72b830ef32
declare -r DISTFILE="pup_${VERSION}_${OS}_${ARCH}.xz"
declare -r URL="https://github.com/frioux/pup/releases/download/untagged-${VERSION}/pup.mac.xz"
if ! command -v xz >/dev/null ; then
echo "xz not found" 1>&2
exit 3
fi
else
declare -r VERSION=0.4.0
declare -r DISTFILE="pup_v${VERSION}_${OS}_${ARCH}.zip"
declare -r URL="https://github.com/ericchiang/pup/releases/download/v${VERSION}/${DISTFILE}"
fi
if [[ -z ${ARCH} || -z ${OS} ]] ; then
echo "pup ${VERSION} is not available for $(uname -s) on $(uname -m)" 1>&2
exit 1
fi
EXPECT_SHA=
while read sum fname ; do
if [[ ${fname} = ${DISTFILE} ]] ; then
EXPECT_SHA=${sum}
break
fi
done <<< "${SHASUMS}"
wget -cO "${TDIR}/${DISTFILE}" "${URL}"
read -r _ GOT_SHA < <( openssl sha256 < "${TDIR}/${DISTFILE}" )
if [[ ${EXPECT_SHA} = ${GOT_SHA} ]] ; then
echo "Checksum for ${DISTFILE} verified :-)"
else
rm -f "${TDIR}/${DISTFILE}" "${TDIR}/pup"
echo "Checksum for ${DISTFILE} does not match :-("
echo " Expected: ${EXPECT_SHA}"
echo " Got: ${GOT_SHA}"
exit 2
fi 1>&2
rm -f "${TDIR}/pup"
if (( USE_FORK )) ; then
(cd "${TDIR}" && xz -dk "${DISTFILE}" && mv "${DISTFILE%.*}" pup && chmod a+x pup)
else
unzip "${TDIR}/${DISTFILE}" pup -d "${TDIR}"
fi

7
t/has-index.test Normal file
View file

@ -0,0 +1,7 @@
#! /bin/bash
cat <<---
This test ensures that the "index.html" is returned instead of a directory
listing when fetching a directory which contains an index file.
--
nginx_start
diff -u "${TESTDIR}/has-index/index.html" <( fetch /has-index/ ) 1>&2

10
t/has-index/index.html Normal file
View file

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Index file test</title>
</head>
<body>
This is <code>index.html</code>.
</body>
</html>

25
t/nginx.conf Normal file
View file

@ -0,0 +1,25 @@
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}

124
t/preamble Normal file
View file

@ -0,0 +1,124 @@
#! /bin/bash
#
# preamble
# Copyright (C) 2016 Adrian Perez <aperez@igalia.com>
#
# SPDX-License-Identifier: BSD-2-Clause
#
function nginx_conf_generate () {
if ${DYNAMIC} ; then
echo 'load_module modules/ngx_http_fancyindex_module.so;'
fi
cat <<-EOF
worker_processes 1;
events { worker_connections 1024; }
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
server_name localhost;
listen 127.0.0.1:${NGINX_PORT};
root ${TESTDIR};
error_page 500 502 503 504 /50x.html;
location = /50x.html { root html; }
location / {
index index.html;
fancyindex on;
$*
}
}
}
EOF
}
readonly NGINX_CONF="${PREFIX}/conf/nginx.conf"
readonly NGINX_PID="${PREFIX}/logs/nginx.pid"
case $(uname -s) in
Darwin)
NGINX_PORT=$(netstat -a -n -finet -ptcp | awk '/LISTEN/ { sub(".+\\.", "", $4) ; seen[$4]=1 }
END { p=1025 ; while (seen[p]) p++; print p}')
;;
*)
NGINX_PORT=$(ss -4Htnl | awk '{ sub("[^:]+:", "", $4) ; seen[$4]=1 }
END { p=1025 ; while (seen[p]) p++; print p}')
;;
esac
readonly NGINX_PORT
rm -f "${NGINX_CONF}" "${NGINX_PID}"
mkdir -p "${PREFIX}/logs"
function pup () {
if [[ -x ${TESTDIR}/pup ]] ; then
"${TESTDIR}/pup" "$@"
else
skip 'Test uses "pup", which is not available'
fi
}
function use () {
case $1 in
pup ) [[ -x ${TESTDIR}/pup ]] \
|| skip 'Test uses "pup", which is unavailable\n' ;;
* ) warn "Invalid 'use' flag: '%s'\n'" "$1" ;;
esac
}
function nginx () {
env - PATH="${PATH}" "${PREFIX}/sbin/nginx" "$@"
}
function nginx_conf () {
nginx_conf_generate "$@" > "${NGINX_CONF}"
}
function nginx_is_running () {
[[ -r ${NGINX_PID} ]] && kill -0 $(< "${NGINX_PID}")
}
function nginx_stop () {
if nginx_is_running ; then nginx -s stop ; fi
rm -f "${NGINX_PID}"
}
trap nginx_stop EXIT
function nginx_start () {
if [[ $# -gt 0 || ! -r ${NGINX_CONF} ]] ; then nginx_conf "$@" ; fi
nginx_stop # Ensure that it is not running.
nginx
local n=0
while [[ ! -r ${NGINX_PID} && n -lt 20 ]] ; do
sleep 0.1 # Wait until pid exists.
n=$((n+1))
done
}
function fetch () {
local -a opts=( -q )
if [[ $1 = --with-headers ]] ; then
opts+=( -S )
shift
fi
wget "${opts[@]}" -O- "http://localhost:${NGINX_PORT}${1:-/}" 2>&1
}
function skip () {
printf '(--) '
printf "$@"
exit 111
} 1>&2
function fail () {
printf '(FF) '
printf "$@"
exit 1
} 1>&2
function warn () {
printf '(WW) '
printf "$@"
} 1>&2

86
t/run Executable file
View file

@ -0,0 +1,86 @@
#!/bin/bash
set -e
if [[ $# -lt 1 || $# -gt 2 ]] ; then
echo "Usage: $0 <prefix-path> [1]" 1>&2
exit 1
fi
# Obtain the absolute path to the tests directory
pushd "$(dirname "$0")" &> /dev/null
readonly T=$(pwd)
popd &> /dev/null
export T
# Same for the nginx prefix directory
pushd "$1" &> /dev/null
readonly prefix=$(pwd)
popd &> /dev/null
dynamic=false
if [[ $# -gt 1 && $2 -eq 1 ]] ; then
dynamic=true
fi
readonly dynamic
declare -a t_pass=( )
declare -a t_fail=( )
declare -a t_skip=( )
for t in `ls "$T"/*.test | sort -R` ; do
name="t/${t##*/}"
name=${name%.test}
printf "${name} ... "
errfile="${name}.err"
outfile="${name}.out"
shfile="${name}.sh"
cat > "${shfile}" <<-EOF
readonly DYNAMIC=${dynamic}
readonly TESTDIR='$T'
readonly PREFIX='${prefix}'
$(< "$T/preamble")
$(< "$t")
EOF
if bash -e "${shfile}" > "${outfile}" 2> "${errfile}" ; then
t_pass+=( "${name}" )
printf 'passed\n'
elif [[ $? -eq 111 ]] ; then
t_skip+=( "${name}" )
printf 'skipped\n'
else
t_fail+=( "${name}" )
printf 'failed\n'
fi
done
for name in "${t_fail[@]}" ; do
echo
printf '=== %s.out\n' "${name}"
cat "${name}.out"
echo
printf '=== %s.err\n' "${name}"
cat "${name}.err"
echo
done
if [[ ${#t_skip[@]} -gt 0 ]] ; then
echo
printf 'Skipped tests:\n'
for name in "${t_skip[@]}" ; do
reason=$(grep '^(\-\-) ' "${name}.err" | head -1)
if [[ -z ${reason} ]] ; then
reason='No reason given'
else
reason=${reason:5}
fi
printf ' - %s: %s\n' "${name}" "${reason:-No reason given}"
done
echo
fi
printf '=== passed/skipped/failed/total: %d/%d/%d/%d\n' \
${#t_pass[@]} ${#t_skip[@]} ${#t_fail[@]} $(( ${#t_pass[@]} + ${#t_fail[@]} ))
if [[ ${#t_fail[@]} -gt 0 ]] ; then
exit 1
fi

0
t/show_dotfiles/.okay Normal file
View file

View file

@ -1,9 +1,9 @@
#! /usr/bin/awk -f
#
# Copyright © Adrian Perez <adrianperez@udc.es>
# Copyright © Adrian Perez <aperez@igalia.com>
#
# Converts an HTML template into a C header suitable for inclusion.
# Take a look at the HACKING.rst file to know how to use it :-)
# Take a look at the HACKING.md file to know how to use it :-)
#
# This code is placed in the public domain.

View file

@ -1,18 +1,20 @@
/* Automagically generated, do not edit! */
static const u_char t01_head1[] = ""
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
"\n"
"<html xmlns=\"http://www.w3.org/1999/xhtml\">"
"\n"
"<!DOCTYPE html>"
"<html>"
"<head>"
"<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"/>"
"<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">"
"<meta name=\"viewport\" content=\"width=device-width\">"
"<style type=\"text/css\">"
"body,html {"
"background:#fff;"
"font-family:\"Bitstream Vera Sans\",\"Lucida Grande\","
"\"Lucida Sans Unicode\",Lucidux,Verdana,Lucida,sans-serif;"
"}"
"tr.e {"
"table {"
"table-layout: fixed;"
"}"
"tr:nth-child(even) {"
"background:#f4f4f4;"
"}"
"th,td {"
@ -34,6 +36,11 @@ static const u_char t01_head1[] = ""
"a:hover {"
"color:#e33;"
"}"
".link {"
"white-space: nowrap;"
"text-overflow: '>';"
"overflow: hidden;"
"}"
"</style>"
"\n"
;
@ -55,28 +62,24 @@ static const u_char t05_body2[] = ""
"\n"
;
static const u_char t06_list1[] = ""
"<table id=\"list\" cellpadding=\"0.1em\" cellspacing=\"0\">"
"\n"
"<colgroup>"
"<col width=\"55%\"/>"
"<col width=\"20%\"/>"
"<col width=\"25%\"/>"
"</colgroup>"
"\n"
"<table id=\"list\">"
"<thead>"
"<tr>"
"<th>File Name</th>"
"<th>File Size</th>"
"<th>Date</th>"
"<th colspan=\"2\"><a href=\"?C=N&amp;O=A\">File Name</a>&nbsp;<a href=\"?C=N&amp;O=D\">&nbsp;&darr;&nbsp;</a></th>"
"<th><a href=\"?C=S&amp;O=A\">File Size</a>&nbsp;<a href=\"?C=S&amp;O=D\">&nbsp;&darr;&nbsp;</a></th>"
"<th><a href=\"?C=M&amp;O=A\">Date</a>&nbsp;<a href=\"?C=M&amp;O=D\">&nbsp;&darr;&nbsp;</a></th>"
"</tr>"
"</thead>"
"\n"
"<tbody>"
"<tr class=\"o\">"
"<td><a href=\"../\">Parent directory/</a></td>"
"<td>-</td>"
"<td>-</td>"
;
static const u_char t_parentdir_entry[] = ""
"<tr>"
"<td colspan=\"2\" class=\"link\"><a href=\"../?C=N&amp;O=A\">Parent directory/</a></td>"
"<td class=\"size\">-</td>"
"<td class=\"date\">-</td>"
"</tr>"
"\n"
;
static const u_char t07_list2[] = ""
"</tbody>"
@ -87,12 +90,13 @@ static const u_char t08_foot1[] = ""
"</html>"
;
#define NFI_TEMPLATE_SIZE (0 \
+ nfi_sizeof_ssz(t05_body2) \
+ nfi_sizeof_ssz(t06_list1) \
+ nfi_sizeof_ssz(t07_list2) \
+ nfi_sizeof_ssz(t08_foot1) \
+ nfi_sizeof_ssz(t01_head1) \
+ nfi_sizeof_ssz(t02_head2) \
+ nfi_sizeof_ssz(t03_head3) \
+ nfi_sizeof_ssz(t04_body1) \
+ nfi_sizeof_ssz(t05_body2) \
+ nfi_sizeof_ssz(t06_list1) \
+ nfi_sizeof_ssz(t_parentdir_entry) \
+ nfi_sizeof_ssz(t07_list2) \
+ nfi_sizeof_ssz(t08_foot1) \
)

View file

@ -1,17 +1,19 @@
<!-- var t01_head1 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width">
<style type="text/css">
body,html {
background:#fff;
font-family:"Bitstream Vera Sans","Lucida Grande",
"Lucida Sans Unicode",Lucidux,Verdana,Lucida,sans-serif;
}
tr.e {
table {
table-layout: fixed;
}
tr:nth-child(even) {
background:#f4f4f4;
}
th,td {
@ -33,6 +35,11 @@
a:hover {
color:#e33;
}
.link {
white-space: nowrap;
text-overflow: '>';
overflow: hidden;
}
</style>
<!-- var t02_head2 -->
@ -53,41 +60,36 @@
</h1>
<!-- var t06_list1 -->
<table id="list" cellpadding="0.1em" cellspacing="0">
<colgroup>
<col width="55%"/>
<col width="20%"/>
<col width="25%"/>
</colgroup>
<table id="list">
<thead>
<tr>
<th>File Name</th>
<th>File Size</th>
<th>Date</th>
<th colspan="2"><a href="?C=N&amp;O=A">File Name</a>&nbsp;<a href="?C=N&amp;O=D">&nbsp;&darr;&nbsp;</a></th>
<th><a href="?C=S&amp;O=A">File Size</a>&nbsp;<a href="?C=S&amp;O=D">&nbsp;&darr;&nbsp;</a></th>
<th><a href="?C=M&amp;O=A">Date</a>&nbsp;<a href="?C=M&amp;O=D">&nbsp;&darr;&nbsp;</a></th>
</tr>
</thead>
<tbody>
<tr class="o">
<td><a href="../">Parent directory/</a></td>
<td>-</td>
<td>-</td>
<!-- var t_parentdir_entry -->
<tr>
<td colspan="2" class="link"><a href="../?C=N&amp;O=A">Parent directory/</a></td>
<td class="size">-</td>
<td class="date">-</td>
</tr>
<!-- var NONE -->
<tr class="e">
<td>test file 1</td>
<tr>
<td colspan="2">test file 1</td>
<td>123kB</td>
<td>date</td>
</tr>
<tr class="o">
<td>test file 2</td>
<tr>
<td colspan="2">test file 2</td>
<td>321MB</td>
<td>date</td>
</tr>
<tr class="e">
<td>test file 3</td>
<tr>
<td colspan="2">test file 3</td>
<td>666</td>
<td>date</td>
</tr>