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

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) (http://acl.bestbits.at/) 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 (http://www.freedesktop.org/Standards/shared-mime-info-spec), 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:

XAttrMimeType On

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!

Write a comment
No comments yet.