summaryrefslogtreecommitdiffstats
path: root/doc/README.html.in
blob: 8915a0e3c3c3e996661b4f758af6fb1f0b944b66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<?xml version="1.0" encoding="iso-8859-1"?> <!-- -*-html-helper-*- -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>mod_mime_xattr @PACKAGE_VERSION@</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>

<body>
<h1><a name="top">mod_mime_xattr @PACKAGE_VERSION@</a></h1>

<p><i>Copyright 2004-2007 Lennart Poettering &lt;@PACKAGE_BUGREPORT@&gt;</i></p>

<ul class="toc">
    <li><a href="#license">License</a></li>
    <li><a href="#news">News</a></li>
    <li><a href="#overview">Overview</a></li>
    <li><a href="#status">Current Status</a></li>
    <li><a href="#documentation">Documentation</a></li>
    <li><a href="#requirements">Requirements</a></li>
    <li><a href="#installation">Installation</a></li>
    <li><a href="#acks">Acknowledgements</a></li>
    <li><a href="#download">Download</a></li>
</ul>

<h2><a name="license">License</a></h2>

<p>Copyright 2004-2007 Lennart Poettering</p>

<p>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</p>

<p>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a></p>

<p>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.</p>

<h2><a name="news">News</a></h2>

<div class="news-date">Tue Apr 17 2007: </div> <p class="news-text"><a
href="@PACKAGE_URL@mod_mime_xattr-0.4.tar.gz">Version 0.4</a> released, changes include: updated for Apache 2.2; for compatibility with older Apache versions please use <tt>mod_mime_xattr</tt> 0.3.</p>

<div class="news-date">Mon Jan 23 2006: </div> <p class="news-text"><a
href="@PACKAGE_URL@mod_mime_xattr-0.3.tar.gz">Version
0.3</a> released; changes include: ported to Apache 2.0 - For Apache 1 use versions <= 0.2</p>

<div class="news-date">Sun Mar 28 2004: </div> <p class="news-text"><a
href="@PACKAGE_URL@mod_mime_xattr-0.2.tar.gz">Version
0.2</a> released; changes include: look for both <tt>user.mime_type</tt> and <tt>user.mime-type</tt> for compliance with XDG</p>

<div class="news-date">Wed Mar 24 2004: </div> <p class="news-text"><a
href="@PACKAGE_URL@mod_mime_xattr-0.1.tar.gz">Version
0.1</a> released</p>

<h2><a name="overview">Overview</a></h2>

<p><tt>mod_mime_xattr</tt> is a module for the <a
href="http://httpd.apache.org/">Apache HTTPD</a> 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 <tt>mod_mime_xattr</tt> has support for
Linux style EAs which are supported by Linux 2.4 with the <a
href="http://acl.bestbits.at/">ACL/EA patches</a> applied and vanilla
Linux 2.6. The following attributes may be used:</p>

<ul>
  <li><tt>user.mime_type</tt>: set the MIME type of a file
  explicitly. This attribute is compatible with the <a
href="http://www.freedesktop.org/Standards/shared-mime-info-spec">shared
MIME database specification</a> as published by <a href="http://www.freedesktop.org/">freedesktop.org</a></li>
  <li><tt>user.charset</tt>: set the charset used in a file</li>
  <li><tt>user.mime_encoding</tt>: set the MIME encoding of a file (e.g. <tt>gzip</tt>)</li>
  <li><tt>user.apache_handler</tt>: set the apache handler of a file explicitly</li>
</ul>
  
  
<h2><a name="status">Current Status</a></h2>

<p>Version @PACKAGE_VERSION@ is stable and more or less feature complete.</p>
  
<h2><a name="documentation">Documentation</a></h2>

<h3>Configuration</h3>

<p>Enable the module by adding a new <tt>LoadModule</tt> to the Apache configuration files:</p>

<pre>
...
LoadModule mime_xattr_module /usr/lib/apache2/modules/mod_mime_xattr.so
...
</pre>

<p>When enabled in the Apache configuration files,
<tt>mod_mime_xattr</tt> introduces two new directory dependent
configuration directives:</p>

<ul>
  <li><tt>XAttrMimeType [On/Off]</tt>; Enable or disable the interpretation of the <tt>user.mime_type</tt>, <tt>user.charset</tt> and <tt>user.mime_encoding</tt> EAs.</li>
  <li><tt>XAttrHandler [On/Off]</tt>; Enable or disable the interpretation of the <tt>user.apache_handler</tt> EA</li>
</ul>

<p>A simple example:</p>

<pre>...
&lt;Directory /var/www&gt;
    XAttrMimeType On
    XAttrHandler On
&lt;/Directory&gt;
...</pre>

<p>In case you want to enable support for extended attributes for the entire server, use something like this:</p>

<pre>...
&lt;Directory /&gt;
    XAttrMimeType On
&lt;/Directory&gt;
...</pre>

<h3>Usage</h3>

<p>You may get/set an extended attribute for a file with the Linux command line utilities <tt>getfattr</tt>/<tt>setfattr</tt>:</p>

<pre>setfattr -n "user.mime_type" -v "text/html" foo.file</pre>

<p>The file <tt>foo.file</tt> will be served as HTML now. For more information consult the concerning man pages.</p>

<p>If used with symbolic links, <tt>mod_mime_xattr</tt> will first
check if an EA is set for the symlink itself, and second for the file
the link points to. The <tt>user.charset</tt> EA is only used when the
<tt>user.mime_type</tt> EA is set as well.</p>

<h3>CGI and PHP scripts</h3>

<p>You may use the <tt>user.apache_handler</tt> EA to mark a file as CGI script:</p>

<pre>setfattr -n "user.apache_handler" -v "cgi-script" foo.html</pre>

<p>This will force the execution of <tt>foo.html</tt> as CGI program,
regardless of the name of the file which identifies it as an HTML
file.</p>

<p>If you have <a href="http://www.php.net/">PHP</a> configured in
your Apache web server you may mark a file as PHP script regardless of
its name:</p>

<pre>setfattr -n "user.mime_type" -v "application/x-httpd-php" bar.html</pre>

<p><b>Think twice</b> before enabling <tt>mod_mime_xattr</tt> 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.</p>

<h2><a name="requirements">Requirements</a></h2>

<p>A current release of Apache 2.2 with <tt>apxs</tt>, the development
headers and libraries installed. You need to install <tt>libattr</tt>
and its development package.</p>

<p>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!</p>

<p><tt>mod_mime_xattr</tt> 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.</p>

<h2><a name="installation">Installation</a></h2>

<p>As this package is made with the GNU autotools you should run
<tt>./configure</tt> inside the distribution directory for configuring
the source tree. After that you should run <tt>make</tt> for
compilation and <tt>make install</tt> (as root) for installation of
<tt>mod_mime_xattr</tt>.</p>

<h2><a name="acks">Acknowledgements</a></h2>

<p>None so far</p>

<h2><a name="download">Download</a></h2>

<p>The newest release is always available from <a href="@PACKAGE_URL@">@PACKAGE_URL@</a></p>

<p>The current release is <a href="@PACKAGE_URL@mod_mime_xattr-@PACKAGE_VERSION@.tar.gz">@PACKAGE_VERSION@</a></p>

<p>Get <tt>mod_mime_xattr</tt>'s development sources from the <a href="http://subversion.tigris.org/">Subversion</a> <a href="svn://svn.0pointer.net/mod_mime_xattr">repository</a> (<a href="http://0pointer.net/cgi-bin/viewcvs.cgi/?root=mod_mime_xattr">viewcvs</a>): </p>

<pre>svn checkout svn://svn.0pointer.net/mod_mime_xattr/trunk mod_mime_xattr</pre>

<p>If you want to be notified whenever I release a new version of this software use the subscription feature of <a href="http://freshmeat.net/projects/mod_mime_xattr/">Freshmeat</a>.</p>

<hr/>
<address class="grey">Lennart Poettering &lt;@PACKAGE_BUGREPORT@&gt;, April 2007</address>
<div class="grey"><i>$Id$</i></div>

</body>
</html>