レナート   PID EINS!   ﻟﻴﻨﺎﺭﺕ

Mon, 23 Jan 2006

Adding Extended Attribute Support to Apache 2.0

I updated my little Apache module mod_mime_xattr to be compatible with Apache 2.0.

What is it useful for? Linux (2.4 with patch, 2.6 out-of-the-box) has been supporting extended attributes for files (EAs) for ages, but very few applications use them. To change that I wrote a small module for Apache which interpretes the EA user.mime_type and uses its value as MIME type for all files served by Apache. The EA has been standardized by the XDG MIME system, but apparently neither Gnome nor KDE support it right now.

Usage of mod_mime_xattr is simple. To enable interpretation of the EA on the entire tree use something like this in your Apache configuration file:

<Directory />
XAttrMimeType On
</Directory>

That's all that is required to make use of user.mime_type on all files where it is set. To set the EA use a command like this one:

setfattr -n "user.mime_type" -v "text/html" foo.txt

And foo.txt will become a file with the MIME type of text/html, although its suffix is .txt!

posted at: 17:24 | path: /projects | permanent link to this entry | comments


It should be obvious but in case it isn't: the opinions reflected here are my own. They are not the views of my employer, or Ronald McDonald, or anyone else.

Please note that I take the liberty to delete any comments posted here that I deem inappropriate, off-topic, or insulting. And I excercise this liberty quite agressively. So yes, if you comment here, I might censor you. If you don't want to be censored you are welcome to comment on your own blog instead.


Lennart Poettering <mzoybt (at) 0pointer (dot) net>
Syndicated on Planet GNOME, Planet Fedora, planet.freedesktop.org, Planet Debian Upstream. feed RSS 0.91, RSS 2.0
Archives: 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013

Valid XHTML 1.0 Strict!   Valid CSS!