Ticket #1 (closed defect: fixed)

Opened 10 years ago

Last modified 8 years ago

Mungo should respect existing MIME types

Reported by: jschulz Assigned to: somebody
Priority: Major Component: Mungo::Response
Severity: 4-16 Hours Keywords: mime content-type headers


Mungo currently defaults to serving all files as text/html. It should try to use any existing Apache (mod_mime) settings before finally falling back to text/html.

To reproduce, add the following to httpd.conf

<Files ~ (\.(asp|css|js|html|xml))>    
   SetHandler  perl-script
   PerlSetVar StatINC 1
   PerlHandler Mungo

Now, all files with those extensions will be served as text/html, even JavaScript? and CSS. If a doctype of:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

is added, the page will "break" because the CSS and JavaScript? will not be recognized as the appropriate type of file.

The page will lack any CSS styling and any JavaScript? will not function.

Remedy: You can add the following to httpd.conf

<Files ~ (\.(css))> 
   PerlSetVar MungoContentType 'text/css'

<Files ~ (\.(js))> 
   PerlSetVar MungoContentType 'text/javascript'

<Files ~ (\.(xml))> 
   PerlSetVar MungoContentType 'text/xml'

but Mungo should respect (or at least try to obtain) those types already set in conf/mime.types.

If reading from conf/mime.types is too difficult/expensive, a single place (mungo.mime ?) to record all those associations would be appreciated.

Change History

06/26/07 16:27:15 changed by jesus

  • status changed from new to closed.
  • resolution set to fixed.

(In [5]) fixes #1

11/30/09 22:22:12 changed by clinton

  • component changed from component1 to Mungo::Response.
  • severity set to 4-16 Hours.