This module determines the file(1) command does. It is intended as a
+ "second line of defense" for files which
+
Unlike file(1) engine and its own magic
+ database, this module uses the system's libmagic(3)
+ library and magic database from the file package,
+ so the types it reports are those which file --mime-type
+ would report. The module is built only if libmagic is found at
+ configure time, and is only active in a server or virtual host
+ where On.
Where libmagic reports application/octet-stream
+ the module sets no type, leaving the response without a
+ Content-Type header, as httpd/unix-directory and empty files as
+ text/plain.
The module does not look inside compressed files and never
+ sets a Content-Encoding: a gzip file is reported as
+ application/gzip. This differs from
+
A libmagic handle is created, loaded with the magic database
+ and destroyed for every request examined, so the module is safe
+ to use with any MPM. Loading a compiled database
+ (magic.mgc) maps the file into memory rather than
+ parsing it, and the mapped pages are shared between all server
+ processes, so this is inexpensive. If the configured database
+ is a text file rather than a compiled one, it is parsed on every
+ request.
Only the first
Examining text content in particular can allocate a few + megabytes of memory temporarily. With a threaded MPM and a C + library which keeps a separate heap per thread, each server + thread retains its peak allocation, so the resident size of a + busy child process can grow by that much per thread before + levelling off. This is not a leak.
+The
The /usr/share/misc/magic, for which
+ the compiled magic.mgc alongside it is loaded).
+ The database must be in the format described in
+ magic(5); the file distributed with
+
Note that the MAGIC environment variable, if set
+ when the server is started, overrides the library default, but
+ not a database given with this directive.
The
When On, the character encoding libmagic detects (such
+ as us-ascii, utf-8 or
+ iso-8859-1) is added as a charset
+ parameter to text/* types, giving for example
+ text/plain; charset=utf-8. Other types are not
+ affected. As with