mod_mime_xattr 0.4 Copyright 2004-2007 Lennart Poettering <mzzvzrkngge (at) 0pointer (dot) net> * [1]License * [2]News * [3]Overview * [4]Current Status * [5]Documentation * [6]Requirements * [7]Installation * [8]Acknowledgements * [9]Download License Copyright 2004-2007 Lennart Poettering Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at [10]http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. News Tue Apr 17 2007: [11]Version 0.4 released, changes include: updated for Apache 2.2; for compatibility with older Apache versions please use mod_mime_xattr 0.3. Mon Jan 23 2006: [12]Version 0.3 released; changes include: ported to Apache 2.0 - For Apache 1 use versions <= 0.2 Sun Mar 28 2004: [13]Version 0.2 released; changes include: look for both user.mime_type and user.mime-type for compliance with XDG Wed Mar 24 2004: [14]Version 0.1 released Overview mod_mime_xattr is a module for the [15]Apache HTTPD 2.2 which may be used to set a range of MIME properties of files served from a document tree with extended attributes (EAs) as supported by the underlying file system. The current version of mod_mime_xattr has support for Linux style EAs which are supported by Linux 2.4 with the [16]ACL/EA patches applied and vanilla Linux 2.6. The following attributes may be used: * user.mime_type: set the MIME type of a file explicitly. This attribute is compatible with the [17]shared MIME database specification as published by [18]freedesktop.org * user.charset: set the charset used in a file * user.mime_encoding: set the MIME encoding of a file (e.g. gzip) * user.apache_handler: set the apache handler of a file explicitly Current Status Version 0.4 is stable and more or less feature complete. Documentation Configuration Enable the module by adding a new LoadModule to the Apache configuration files: ... LoadModule mime_xattr_module /usr/lib/apache2/modules/mod_mime_xattr.so ... When enabled in the Apache configuration files, mod_mime_xattr introduces two new directory dependent configuration directives: * XAttrMimeType [On/Off]; Enable or disable the interpretation of the user.mime_type, user.charset and user.mime_encoding EAs. * XAttrHandler [On/Off]; Enable or disable the interpretation of the user.apache_handler EA A simple example: ... <Directory /var/www> XAttrMimeType On XAttrHandler On </Directory> ... In case you want to enable support for extended attributes for the entire server, use something like this: ... <Directory /> XAttrMimeType On </Directory> ... Usage You may get/set an extended attribute for a file with the Linux command line utilities getfattr/setfattr: setfattr -n "user.mime_type" -v "text/html" foo.file The file foo.file will be served as HTML now. For more information consult the concerning man pages. If used with symbolic links, mod_mime_xattr will first check if an EA is set for the symlink itself, and second for the file the link points to. The user.charset EA is only used when the user.mime_type EA is set as well. CGI and PHP scripts You may use the user.apache_handler EA to mark a file as CGI script: setfattr -n "user.apache_handler" -v "cgi-script" foo.html This will force the execution of foo.html as CGI program, regardless of the name of the file which identifies it as an HTML file. If you have [19]PHP configured in your Apache web server you may mark a file as PHP script regardless of its name: setfattr -n "user.mime_type" -v "application/x-httpd-php" bar.html Think twice before enabling mod_mime_xattr for document trees you do not trust because a rogue user may mark his files as executable CGI or PHP scripts with the technique described above. Requirements A current release of Apache 2.2 with apxs, the development headers and libraries installed. You need to install libattr and its development package. A port to other EA APIs has not been done yet. It should be fairly easy to do, however. Feel free to send me patches! mod_mime_xattr was developed and tested on Debian GNU/Linux "testing" from January 2006, it should work on most other Linux distributions since it uses GNU autoconf source code configuration. Installation As this package is made with the GNU autotools you should run ./configure inside the distribution directory for configuring the source tree. After that you should run make for compilation and make install (as root) for installation of mod_mime_xattr. Acknowledgements None so far Download The newest release is always available from [20]http://0pointer.de/lennart/projects/mod_mime_xattr/ The current release is [21]0.4 Get mod_mime_xattr's development sources from the [22]Subversion [23]repository ([24]viewcvs): svn checkout svn://svn.0pointer.net/mod_mime_xattr/trunk mod_mime_xattr If you want to be notified whenever I release a new version of this software use the subscription feature of [25]Freshmeat. _________________________________________________________________ Lennart Poettering <mzzvzrkngge (at) 0pointer (dot) net>, April 2007 $Id: README.html.in 34 2007-04-17 12:56:08Z lennart $ References 1. README#license 2. README#news 3. README#overview 4. README#status 5. README#documentation 6. README#requirements 7. README#installation 8. README#acks 9. README#download 10. http://www.apache.org/licenses/LICENSE-2.0 11. http://0pointer.de/lennart/projects/mod_mime_xattr/mod_mime_xattr-0.4.tar.gz 12. http://0pointer.de/lennart/projects/mod_mime_xattr/mod_mime_xattr-0.3.tar.gz 13. http://0pointer.de/lennart/projects/mod_mime_xattr/mod_mime_xattr-0.2.tar.gz 14. http://0pointer.de/lennart/projects/mod_mime_xattr/mod_mime_xattr-0.1.tar.gz 15. http://httpd.apache.org/ 16. http://acl.bestbits.at/ 17. http://www.freedesktop.org/Standards/shared-mime-info-spec 18. http://www.freedesktop.org/ 19. http://www.php.net/ 20. http://0pointer.de/lennart/projects/mod_mime_xattr/ 21. http://0pointer.de/lennart/projects/mod_mime_xattr/mod_mime_xattr-0.4.tar.gz 22. http://subversion.tigris.org/ 23. svn://svn.0pointer.net/mod_mime_xattr 24. http://0pointer.net/cgi-bin/viewcvs.cgi/?root=mod_mime_xattr 25. http://freshmeat.net/projects/mod_mime_xattr/