Skip to content

Commit

Permalink
Use only the new-style module configuration for dynamic builds
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aperezdc committed Aug 18, 2016
1 parent 3ec11d5 commit 5e62120
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# vim:ft=sh:
ngx_addon_name=ngx_http_fancyindex_module

if test -n "$ngx_module_link"; then
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!
Expand Down
7 changes: 7 additions & 0 deletions t/has-index.test
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 0 deletions t/has-index/index.html
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit 5e62120

Please sign in to comment.