It’s one of those things I’m pretty sure I’ve done before and couldn’t put my hands on anymore, so I’ll just leave it here. Hopefully it serves someone else, or myself, at some point.
I was looking for a way to add a “warning” banner, such as the one which is now up at http://svn.magnolia-cms.com/svn.
mod_dav_svn, the Apache mod used to serve Subversion repositories over HTTP, can also be used as a minimal front-end for html-based browsing of repositories. Unfortunately, its output is not very customizable, if at all: all you get is a directive that lets you specify an xslt sheet (yuck) for transforming the output; and if you do decide to go down that route, the transformation happens on the client side.
So I thought about using another Apache mod to modify the content served by
mod_dav_svn. At first, I was going to go for a crude User-Agent detection, but realized that, when requested via a browser, the content was sent as
text/html, while when requested via a proper SVN client, it was sent as
text/xml. Good, then all I needed was provided by mod_ext_filter. All that was left to do was figure out the command I’d want to run with this filter…