For some projects I had to figure out a way to deliver a file via Apache2 but still being able to put some business logic before the download. Imagine you have a php, perl, rails, ruby or whatever project and want to check credentials before delivering a file while not blocking your application with submitting large amounts of data. Lighttpd has a mechanism called „xsendfile“ for this. To make it short, this looks for a X-Sendfile header sent by the application. If this header is set and directs to a file the web server stops processing its script and starts delivering a file.
Fortunately there is a promising Apache2 port for this: mod-xsendfile. As I had to compile this serveral times and did not find it in Debian unstable or Ubuntu I made it my first packaging attempt (after having attended the first German Packaging Jam held by Daniel Holbach – thank you!).
If you like, you can test the module for hardy by enabling my ppa archive:
deb http://ppa.launchpad.net/damokles/ubuntu hardy main deb-src http://ppa.launchpad.net/damokles/ubuntu hardy main
and „aptitude install libapache2-mod-xsendfile“ afterwards. See the website for reference. I will also upload this to my ppa for stable releases within the next days.
There is a launchpad bug I created for this. Feel free to test the module and the package and add comments there or directly here. Sadfully this package is to late to be integrated into hardy, so maybe the Intrepid Ibex (what a name…) will be a good milestone.