Bug #1893

dir-listing vs. index-file

Added by woods over 5 years ago. Updated over 5 years ago.

Status:NewStart date:2009-02-10
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
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 5 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 5 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 5 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)

Also available in: Atom