Pages

Saturday, 28 July 2012

Raspberry Pi - Raspbian Lighttpd Mime Types


Anyway Ive been having a few problems with mime types and lighttpd, this has all come after I migrated my Raspberry Pi - Personal Podcast solution from Debian squeeze to Raspbian distributions and the 'differences' between the versions.

Mime types are assigned to file extensions (e.g. .html = text/html) and are loaded through the lighttpd's config file (sort of), specifically:

/etc/lighttpd/lighttpd.conf

includes a script

include_shell "/usr/share/lighttpd/create-mime.assign.pl"

which uses a file of mime types and file extensions

/etc/mime.types

to make the associations!

All the mime types and associated file extensions are stored in this file as a table and if you need to create, modify or remove them its as simple as modifying this file.

sudo nano /etc/mime.types

The mime types are stored as text, with mime types to file extension(s):

audio/mpeg                   mpga mpega mp2 mp3 m4a aac
text/html                    html htm shtml
video/mp4                    mp4
text/rtf

The issue I experienced was that Debian Squeeze and Raspbian distributions install different versions of the mime.types file.

I was specifically interested in the application/rss+xml mime type as without it browsers wouldn't recognise an rss (podcast) feed, in Debian Squeeze the mime mapping was as expected:

application/rss+xml          rss

However in Raspbian it was:

application/x-rss+xml        rss

Wikipedia's page on mime types told me that the x meant "Types or subtypes that begin with x- are non-standard (they are not registered with IANA)".  Now the application/rss+xml isn't registered with IANA so it is technically correct that it should be x-rss+xml but not very helpful because all the browsers I tested only identify rss+xml and why this change was made between versions is a mystery.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.