The default module is cool and fast, but i lacks some features like it doesn’t show the modes of the files, and not all tags are associated with class names which limits our usage in using an external css. So i made an attempt to add these to the default module.
as lighttpd runs based on a config file, you have to code the config file every-time or you can write a custom script with cmdline-args(for config) to do that for you, here’s mine
It starts a port scan from 9009 and searches for the available one to bind lighttpd, adds all known mimetypes(from python module) to the config, copies external css for mod_dirlisting. and of-course document root is current directory.
At first i tried to implement the features as mod_cgi – python using jinja which is obviously the easy way but unfortunately the mod_cgi – python is deadly slow, it decreased the speed from 360 requests / sec to 7 requests / sec. here’s my index.jinja2 and dir-generator.py.cgi
For adding class names to the tags, we have to edit mod_dirlisting.c, system stat call will provide the modes of file.
If you want to test it on your computer, here’s my mod_dirlisting.c, and its git diff(just in case)
[git diff src/mod_dirlisting.c: https://gist.github.com/553cfd249bffef44369c]
[style.css: https://gist.github.com/6609af61d4fa2f1682fc] (most of it is from bootstrap.css)