The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Apache2::MimeInfo - Content-Type header informed by shared-mime-info

VERSION

Version 0.06

SYNOPSIS

    PerlLoadModule Apache2::MimeInfo
    PerlOutputFilterHandler Apache2::MimeInfo

DESCRIPTION

This module bolts File::MimeInfo::Magic and the shared-mime-info database to Apache 2.x. Its purpose is to clean up Content-Type headers on responses that come from potentially misconfigured or untrustworthy sources (e.g. a proxy).

Insert Apache2::MimeInfo as an output filter as described in the synopsis to perform content-based type checking against a more robust database than the one that comes along with file. The type asserted by the original content handler will be overridden by this filter unless the asserted type is a more specific instance of a more general detected type. For instance, Microsoft's .docx format is a ZIP file with special contents. Its MIME type is this:

    application/vnd.openxmlformats-officedocument.wordprocessingml.document

The detector, however, will perceive application/zip, which is an ancestor type. If whatever content handler producing the document asserts the correct type, then this module will do nothing. If, however, it returns something like application/octet-stream, which is even more generic than application/zip, this module will replace the Content-Type header with application/zip. It will likewise replace the Content-Type header if it is missing altogether, or if it asserts a type that is inconsitent with the one which was detected.

If you aren't familiar with shared-mime-info, it's an XML database containing useful information about the mappings of, and relations between MIME types. This means that you can hack new type signatures into it, just as you can with file.

AUTHOR

Dorian Taylor, <dorian at cpan.org>

BUGS

Please report any bugs or feature requests to bug-apache2-mimeinfo at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Apache2-MimeInfo. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Apache2::MimeInfo

You can also look for information at:

SEE ALSO

File::MimeInfo
File::MMagic
http://perl.apache.org/

LICENSE AND COPYRIGHT

Copyright 2013 Dorian Taylor.

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