Apache2::MimeInfo - Content-Type header informed by shared-mime-info
Version 0.06
PerlLoadModule Apache2::MimeInfo PerlOutputFilterHandler Apache2::MimeInfo
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).
Content-Type
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:
.docx
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.
application/zip
application/octet-stream
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.
Dorian Taylor, <dorian at cpan.org>
<dorian at cpan.org>
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.
bug-apache2-mimeinfo at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Apache2::MimeInfo
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Apache2-MimeInfo
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Apache2-MimeInfo
CPAN Ratings
http://cpanratings.perl.org/d/Apache2-MimeInfo
Search CPAN
http://search.cpan.org/dist/Apache2-MimeInfo/
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.
To install Apache2::MimeInfo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache2::MimeInfo
CPAN shell
perl -MCPAN -e shell install Apache2::MimeInfo
For more information on module installation, please visit the detailed CPAN module installation guide.