mod_mime_magic.html revision e0b181d3bfa99dfb992df3024b397660cb7afbe9
fd5a4eacd56700ffb08a73121aeacdc806cb0132Sumit Bose<html xmlns="http://www.w3.org/TR/xhtml1/strict"><head><!--
fd5a4eacd56700ffb08a73121aeacdc806cb0132Sumit Bose XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
8b1f525acd20f36c836e827de3c251088961c5d9Stephen Gallagher This file is generated from xml source: DO NOT EDIT
8b1f525acd20f36c836e827de3c251088961c5d9Stephen Gallagher XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
8b1f525acd20f36c836e827de3c251088961c5d9Stephen Gallagher --><title>mod_mime_magic- Apache HTTP Server</title><link rel="stylesheet" type="text/css" href="/style/manual.css"/></head><body><blockquote><div align="center"><img src="/images/sub.gif" alt="[APACHE DOCUMENTATION]"/><h3>Apache HTTP Server Version 2.0</h3></div><h1 align="center">Apache Module mod_mime_magic</h1><table bgcolor="#cccccc" cellpadding="0" cellspacing="1"><tr><td><table bgcolor="#ffffff"><tr><td valign="top"><span class="help">Description:</span></td><td>Determines the MIME type of a file
8b1f525acd20f36c836e827de3c251088961c5d9Stephen Gallagher by looking at a few bytes of its contents</td></tr><tr><td><a class="help" href="module-dict.html#Status">Status:</a></td><td>Extension</td></tr><tr><td><a class="help" href="module-dict.html#ModuleIdentifier">Module&nbsp;Identifier:</a></td><td>mime_magic_module</td></tr></table></td></tr></table><h2>Summary</h2>
8b1f525acd20f36c836e827de3c251088961c5d9Stephen Gallagher <p>This module determines the MIME type of files in the same
84ae5edab16ad6be5e3be956cb6fa031c1428eb5Stephen Gallagher way the Unix file(1) command works: it looks at the first few
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher bytes of the file. It is intended as a "second line of defense"
df4cc3a83c5d6700b6a09ff96cb4a6b1949b1aa9Stephen Gallagher for cases that <code><a href="mod_mime.html">mod_mime</a></code> can't
df4cc3a83c5d6700b6a09ff96cb4a6b1949b1aa9Stephen Gallagher resolve. To assure that mod_mime gets first try at determining
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher a file's MIME type, be sure to list mod_mime_magic
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <strong>before</strong> mod_mime in the configuration.</p>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <p>This module is derived from a free version of the
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <code>file(1)</code> command for Unix, which uses "magic
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher numbers" and other hints from a file's contents to figure out
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher what the contents are. This module is active only if the magic
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher file is specified by the <a class="directive" href="#mimemagicfile"><code class="directive">MimeMagicFile</code></a> directive.</p>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher<h2>Directives</h2><ul><li><a href="#mimemagicfile">MimeMagicFile</a></li></ul><h2>Format of the Magic File</h2>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <p>The contents of the file are plain ASCII text in 4-5
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher columns. Blank lines are allowed but ignored. Commented lines
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher use a hash mark "#". The remaining lines are parsed for the
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher following columns:</p>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <table border="1">
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <tr valign="top">
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <th>Column</th>
d921c1eba437662437847279f251a0a5d8f70127Maxim
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <th>Description</th>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher </tr>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <tr valign="top">
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>1</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
2a5790216f57e9bdfb2930d52860bb5300366536Jakub Hrozek <td>byte number to begin checking from<br/>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher "&gt;" indicates a dependency upon the previous non-"&gt;"
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher line</td>
4dd615c01357b8715711aad6820ba9595d3ad377Stephen Gallagher </tr>
4b6a0d0b3d42e5fdb457f47d9adfa5e66b160256Stephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <tr valign="top">
b32159300fea63222d8dd9200ed634087704ea74Stephen Gallagher <td>2</td>
b32159300fea63222d8dd9200ed634087704ea74Stephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher type of data to match
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <table border="1">
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <tr>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>byte</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
be1ef1c62ad13612be5e1f879476c24452a5d6d0Stephen Gallagher <td>single character</td>
be1ef1c62ad13612be5e1f879476c24452a5d6d0Stephen Gallagher </tr>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <tr>
4dd615c01357b8715711aad6820ba9595d3ad377Stephen Gallagher <td>short</td>
4dd615c01357b8715711aad6820ba9595d3ad377Stephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>machine-order 16-bit integer</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher </tr>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <tr>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>long</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>machine-order 32-bit integer</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher </tr>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <tr>
c737e1444fb186e349e59bfa9dac4995b720b4b1Jan Zeleny <td>string</td>
f1828234a850dd28465425248a83a993f262918fPavel Březina
f1828234a850dd28465425248a83a993f262918fPavel Březina <td>arbitrary-length string</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher </tr>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <tr>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>date</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>long integer date (seconds since Unix
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher epoch/1970)</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher </tr>
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina <tr>
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina <td>beshort</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>big-endian 16-bit integer</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher </tr>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <tr>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>belong</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>big-endian 32-bit integer</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher </tr>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <tr>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>bedate</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>big-endian 32-bit integer date</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher </tr>
69aaef8719c5cf33ed1c4090fa313ba281bf8a02Jakub Hrozek
4dd615c01357b8715711aad6820ba9595d3ad377Stephen Gallagher <tr>
fe60346714a73ac3987f786731389320633dd245Pavel Březina <td>leshort</td>
4dd615c01357b8715711aad6820ba9595d3ad377Stephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>little-endian 16-bit integer</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher </tr>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <tr>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>lelong</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
bf5a808fa92007c325c3996e79694badfab201d4Stephen Gallagher <td>little-endian 32-bit integer</td>
bf5a808fa92007c325c3996e79694badfab201d4Stephen Gallagher </tr>
bf5a808fa92007c325c3996e79694badfab201d4Stephen Gallagher
667db40da4db362d7ca0a1f7f1c4ba40fb71795aJakub Hrozek <tr>
667db40da4db362d7ca0a1f7f1c4ba40fb71795aJakub Hrozek <td>ledate</td>
bf5a808fa92007c325c3996e79694badfab201d4Stephen Gallagher
bf5a808fa92007c325c3996e79694badfab201d4Stephen Gallagher <td>little-endian 32-bit integer date</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher </tr>
bf5a808fa92007c325c3996e79694badfab201d4Stephen Gallagher </table>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher </td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher </tr>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <tr valign="top">
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>3</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>contents of data to match</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher </tr>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <tr valign="top">
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>4</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>MIME type if matched</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher </tr>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <tr valign="top">
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>5</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <td>MIME encoding if matched (optional)</td>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher </tr>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher </table>
3b08dec5ee634f83ee18e1753d5ffe0ac5e3c458Jakub Hrozek
69aaef8719c5cf33ed1c4090fa313ba281bf8a02Jakub Hrozek <p>For example, the following magic file lines would recognize
3b08dec5ee634f83ee18e1753d5ffe0ac5e3c458Jakub Hrozek some audio formats.</p>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher<pre>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher# Sun/NeXT audio data
69aaef8719c5cf33ed1c4090fa313ba281bf8a02Jakub Hrozek0 string .snd
69aaef8719c5cf33ed1c4090fa313ba281bf8a02Jakub Hrozek&gt;12 belong 1 audio/basic
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher&gt;12 belong 2 audio/basic
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher&gt;12 belong 3 audio/basic
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher&gt;12 belong 4 audio/basic
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher&gt;12 belong 5 audio/basic
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher&gt;12 belong 6 audio/basic
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher&gt;12 belong 7 audio/basic
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher&gt;12 belong 23 audio/x-adpcm
3b1df539835367cb81cd5ff0f9959947d5642e55Stephen Gallagher</pre>
3b1df539835367cb81cd5ff0f9959947d5642e55Stephen Gallagher</code></td></tr></table></blockquote>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <p>Or these would recognize the difference between "*.doc" files
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher containing Microsoft Word or FrameMaker documents. (These are
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher incompatible file formats which use the same file suffix.)</p>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher<pre>
667db40da4db362d7ca0a1f7f1c4ba40fb71795aJakub Hrozek# Frame
667db40da4db362d7ca0a1f7f1c4ba40fb71795aJakub Hrozek0 string \&lt;MakerFile application/x-frame
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher0 string \&lt;MIFFile application/x-frame
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher0 string \&lt;MakerDictionary application/x-frame
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher0 string \&lt;MakerScreenFon application/x-frame
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher0 string \&lt;MML application/x-frame
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher0 string \&lt;Book application/x-frame
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher0 string \&lt;Maker application/x-frame
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
15b266d9f14dad26da8678a79019749d0f69532eStephen Gallagher# MS-Word
667db40da4db362d7ca0a1f7f1c4ba40fb71795aJakub Hrozek0 string \376\067\0\043 application/msword
667db40da4db362d7ca0a1f7f1c4ba40fb71795aJakub Hrozek0 string \320\317\021\340\241\261 application/msword
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher0 string \333\245-\0\0\0 application/msword
84ae5edab16ad6be5e3be956cb6fa031c1428eb5Stephen Gallagher</pre>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher</code></td></tr></table></blockquote>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <p>An optional MIME encoding can be included as a fifth column.
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher For example, this can recognize gzipped files and set the
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher encoding for them.</p>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher<pre>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher# gzip (GNU zip, not to be confused with [Info-ZIP/PKWARE] zip archiver)
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher0 string \037\213 application/octet-stream x-gzip
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher</pre>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher</code></td></tr></table></blockquote>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher<h2>Performance Issues</h2>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <p>This module is not for every system. If your system is barely
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher keeping up with its load or if you're performing a web server
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher benchmark, you may not want to enable this because the
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher processing is not free.</p>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <p>However, an effort was made to improve the performance of
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher the original file(1) code to make it fit in a busy web server.
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher It was designed for a server where there are thousands of users
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher who publish their own documents. This is probably very common
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher on intranets. Many times, it's helpful if the server can make
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher more intelligent decisions about a file's contents than the
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher file name allows ...even if just to reduce the "why doesn't my
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher page work" calls when users improperly name their own files.
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher You have to decide if the extra work suits your
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher environment.</p>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <p>When compiling an Apache server, this module should be at or
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher near the top of the list of modules in the Configuration file.
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher The modules are listed in increasing priority so that will mean
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher this one is used only as a last resort, just like it was
bfbf5cb0f00c60c0f000f56c282377b13b9a89abSumit Bose designed to.</p>
b32159300fea63222d8dd9200ed634087704ea74Stephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher<h2><a name="notes">Notes</a></h2>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <p>The following notes apply to the mod_mime_magic module and are
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher included here for compliance with contributors' copyright
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher restrictions that require their acknowledgment. </p>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher<pre>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher/*
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * mod_mime_magic: MIME type lookup via file magic numbers
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * Copyright (c) 1996-1997 Cisco Systems, Inc.
0ef783e186ef1c9f60e61a4e8e54c44cb366fdfePavel Březina *
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * This software was submitted by Cisco Systems to the Apache Group in July
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * 1997. Future revisions and derivatives of this source code must
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * acknowledge Cisco Systems as the original contributor of this module.
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * All other licensing and usage conditions are those of the Apache Group.
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher *
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * Some of this code is derived from the free version of the file command
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * originally posted to comp.sources.unix. Copyright info for that program
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * is included below as required.
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * ---------------------------------------------------------------------------
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * - Copyright (c) Ian F. Darwin, 1987. Written by Ian F. Darwin.
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher *
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * This software is not subject to any license of the American Telephone and
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * Telegraph Company or of the Regents of the University of California.
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher *
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * Permission is granted to anyone to use this software for any purpose on any
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * computer system, and to alter it and redistribute it freely, subject to
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * the following restrictions:
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher *
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * 1. The author is not responsible for the consequences of use of this
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * software, no matter how awful, even if they arise from flaws in it.
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher *
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * 2. The origin of this software must not be misrepresented, either by
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * explicit claim or by omission. Since few users ever read sources, credits
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * must appear in the documentation.
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher *
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * 3. Altered versions must be plainly marked as such, and must not be
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * misrepresented as being the original software. Since few users ever read
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * sources, credits must appear in the documentation.
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher *
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * 4. This notice may not be removed or altered.
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * -------------------------------------------------------------------------
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher *
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * For compliance with Mr Darwin's terms: this has been very significantly
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * modified from the free "file" command.
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * - all-in-one file for compilation convenience when moving from one
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * version of Apache to the next.
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * - Memory allocation is done through the Apache API's pool structure.
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * - All functions have had necessary Apache API request or server
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * structures passed to them where necessary to call other Apache API
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * routines. (<em>i.e.</em>, usually for logging, files, or memory allocation in
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * itself or a called function.)
126c9338cf12a3e4404c36bbe4ec14b18f23537cMaxim * - struct magic has been converted from an array to a single-ended linked
fe2091327ff44f80d6681c261494e4432404e9baStephen Gallagher * list because it only grows one record at a time, it's only accessed
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * sequentially, and the Apache API has no equivalent of realloc().
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * - Functions have been changed to get their parameters from the server
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * configuration instead of globals. (It should be reentrant now but has
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * not been tested in a threaded environment.)
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * - Places where it used to print results to stdout now saves them in a
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * list where they're used to set the MIME type in the Apache request
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * record.
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher * - Command-line flags have been removed since they will never be used here.
2e6087c6cc903d5164b9a1d5e3d791fd046001d9Jakub Hrozek *
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher */
126c9338cf12a3e4404c36bbe4ec14b18f23537cMaxim</pre>
fe2091327ff44f80d6681c261494e4432404e9baStephen Gallagher<hr/><h2><a name="MimeMagicFile">MimeMagicFile</a> <a name="mimemagicfile">Directive</a></h2><table bgcolor="#cccccc" border="0" cellspacing="0" cellpadding="1"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>Enable MIME-type determination based on file contents
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagherusing the specified magic file</td></tr><tr><td><a class="help" href="directive-dict.html#Syntax">Syntax:</a></td><td>MimeMagicFile <em>file-path</em></td></tr><tr><td><a class="help" href="directive-dict.html#Context">Context:</a></td><td>server config, virtual host</td></tr><tr><td><a class="help" href="directive-dict.html#Status">Status:</a></td><td>Extension</td></tr><tr><td><a class="help" href="directive-dict.html#Module">Module:</a></td><td>mod_mime_magic</td></tr></table></td></tr></table>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <p>The <code class="directive">MimeMagicFile</code> directive can be used to
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher enable this module, the default file is distributed at
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher <code>conf/magic</code>. Non-rooted paths are relative to the
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher ServerRoot. Virtual hosts will use the same file as the main
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher server unless a more specific setting is used, in which case
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher the more specific setting overrides the main server's file.</p>
551aa6c36797ed720487f5974dcadabf19e6ff9fStephen Gallagher<hr/></blockquote><h3 align="center">Apache HTTP Server Version 2.0</h3><a href="./"><img src="/images/index.gif" alt="Index"/></a><a href="../"><img src="/images/home.gif" alt="Home"/></a></body></html>