Apache2-MimeInfo

 view release on metacpan or  search on metacpan

lib/Apache2/MimeInfo.pm  view on Meta::CPAN

our $VERSION = '0.06';

=head1 SYNOPSIS

    PerlLoadModule Apache2::MimeInfo
    PerlOutputFilterHandler Apache2::MimeInfo

=head1 DESCRIPTION

This module bolts L<File::MimeInfo::Magic> and the
L<shared-mime-info|http://freedesktop.org/wiki/Software/shared-mime-info/>
database to Apache 2.x. Its purpose is to clean up C<Content-Type>
headers on responses that come from potentially misconfigured or
untrustworthy sources (e.g. a proxy).

Insert L<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
L<file|http://darwinsys.com/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 I<detected>

lib/Apache2/MimeInfo.pm  view on Meta::CPAN

The detector, however, will perceive C<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 C<application/octet-stream>, which
is even more generic than C<application/zip>, this module will replace
the C<Content-Type> header with C<application/zip>. It will likewise
replace the C<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
L<shared-mime-info|http://freedesktop.org/wiki/Software/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
L<file|http://darwinsys.com/file/>.

=cut

my %SKIP = (
    'application/x-gzip'     => 1,
    'application/x-compress' => 1,



( run in 0.509 second using v1.01-cache-2.11-cpan-299005ec8e3 )