Project

General

Profile

Bug #1893

dir-listing vs. index-file

Added by woods over 7 years ago. Updated 4 months ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
2009-02-10
Due date:
% Done:

0%

Missing in 1.5.x:

Description

I don't know if this is a documentation "bug", or a real bug -- I'm not sure what the true intent of the feature interaction is now.

According to the docs (i.e. those distributed with the version I'm running, i.e. 1.4.20):

"A directory listing is generated if a directory is requested and no index-file
was found in that directory."

However it seems to me that dir-listing takes precedence over index-file as whenever I turn on dir-listing.activate I always get directory listings even when any (or all!) of the index-file.names files are present in the requested directory.

I think if for nothing else than compatibility with Apache this is actually a code bug -- i.e. the docs should be right.

(Note I'm running a fully static-linked lighttpd built with -DLIGHTTPD_STATIC.)

History

#1 Updated by stbuehler over 7 years ago

Iirc, we do not really support static builds (nor the scons build system); i think the problem is that mod_dirlisting is "loaded" before mod_indexfile. Try changing the order in src/SConscript.

#2 Updated by woods over 7 years ago

if module loading order is important in this issue, then I would say that's a very serious bug!

I find it amazing that I have to point out that mod_dirlisting and mod_indexfile are always pre-loaded.

So, this problem should occur for dynamic-linked versions too since it is impossible to dynamically load them, especially in any different order.

From the server-config page the "loaded modules" table shows:

access
accesslog
alias
auth
cgi
compress
dirlisting
evhost
expire
extforward
fastcgi
flv_streaming
indexfile
proxy
redirect
rewrite
rrd
scgi
secdownload
setenv
simple_vhost
ssi
staticfile
status
trigger_b4_dl
userdir
usertrack
webdav

If this is the order they are "loaded" in (instead of what appears to be an alphabetically sorted output list) then it would seem as if the build system ignores the documented constraints for module loading order. Sigh. This kind of bug should be easily caught in early simple testing.

(BTW, static-linking is a necessary feature for many secure and embedded environments -- not fully supporting it also a serious bug in my estimation.)

#3 Updated by woods over 7 years ago

At the moment the following manually generated "src/plugin-static.h" file seems to do the trick, though I've nowhere near tested all functionality yet -- just the minimum my site requires. #ifdefs are not used for PCRE or libz because my pkgsrc module requires those as non-optional dependencies. The opening comment is of course from the (inadequate, IMO) docs.

/* * The modules are executed in the order as they are specified. Loading * mod_auth AFTER mod_fastcgi might disable authentication for fastcgi * backends (if check-local is disabled). * * As auth should be done first, move it before all executing modules (like * proxy, fastcgi, scgi and cgi). * * rewrites, redirects and access should be first, followed by auth and * the docroot plugins. * * Afterwards the external handlers like fastcgi, cgi, scgi and proxy and * at the bottom the post-processing plugins like mod_accesslog.
*/

PLUGIN_INIT(mod_rewrite) /* PCRE /
PLUGIN_INIT(mod_redirect) /
PCRE */
PLUGIN_INIT(mod_alias)

PLUGIN_INIT(mod_extforward)

PLUGIN_INIT(mod_access)
PLUGIN_INIT(mod_auth) /* CRYPT LDAP LBER */

PLUGIN_INIT(mod_setenv)

#ifdef HAVE_LUA
PLUGIN_INIT(mod_magnet) /* LUA */
#endif
PLUGIN_INIT(mod_flv_streaming)

/* * indexfile must come before dirlisting for dirlisting not to override
*/
PLUGIN_INIT(mod_indexfile)
PLUGIN_INIT(mod_userdir)
PLUGIN_INIT(mod_dirlisting)

PLUGIN_INIT(mod_status)

PLUGIN_INIT(mod_simple_vhost)
PLUGIN_INIT(mod_evhost)
#ifdef HAVE_MYSQL
PLUGIN_INIT(mod_mysql_vhost) /* MySQL */
#endif

PLUGIN_INIT(mod_secdownload)

PLUGIN_INIT(mod_cgi)
PLUGIN_INIT(mod_fastcgi)
PLUGIN_INIT(mod_scgi)
PLUGIN_INIT(mod_ssi) /* PCRE */
PLUGIN_INIT(mod_proxy)

/* * staticfile must come after cgi/ssi/et al.
*/
PLUGIN_INIT(mod_staticfile)

#ifdef HAVE_LUA
PLUGIN_INIT(mod_cml) /* MEMCACHE LUA LUALIB */
#endif

PLUGIN_INIT(mod_trigger_b4_dl) /* PCRE */

PLUGIN_INIT(mod_webdav) /* XML2 SQLITE3 UUID */

/* * post-processing modules
/
PLUGIN_INIT(mod_evasive)
PLUGIN_INIT(mod_compress) /
Z BZ2 */
PLUGIN_INIT(mod_usertrack)
PLUGIN_INIT(mod_expire)
PLUGIN_INIT(mod_rrdtool)
PLUGIN_INIT(mod_accesslog)

#4 Updated by gstrauss 4 months ago

Fixed. modules are now loaded in the order specified in the config file (lighttpd.conf)

commit b66fa2cb68a7c0ca6fae280bd71662d5ddce8c24
Author: Stefan Bühler <stbuehler@web.de>
Date:   Sat Aug 29 09:28:01 2015 +0000

    [plugins] when modules are linked statically still only load the modules given in the config

    - previously it would load all modules in some fixed order
    - also warn when mod_magnet or mod_trigger_b4_dl are compiled without
      needed dependencies
    - mod_trigger_b4_dl fails in plugin_init when dependencies are missing

    From: Stefan Bühler <stbuehler@web.de>

    git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3029 152afb58-edef-0310-8abb-c4023f1b3aa9

If mod_indexfile and mod_dirlisting (and mod_staticfile) are not specified in the lighttpd.conf, they are added, with mod-indexfile being prepended to the modules list and mod_dirlisting and mod_staticfile being appended to the modules list.

Note: even if mod_indexfile and mod_dirlisting are always loaded, neither is active until configured in the configuration file. For mod_indexfile, this involves specifying the index file names. For mod_dirlisting, this requires dir-listing.activate = "enable"

#5 Updated by gstrauss 4 months ago

  • Status changed from New to Fixed

Also available in: Atom