Add content type detection and inclusion.

This is necessary, for instance, for mp3 files to play properly
in Firefox in the html5 native player.  It will not play audio
if the content type is binary/octet-stream (which everything is
defaulting to currently)
Handle possible NoMethodError bug

Since there's no else, need the assignment outside the conditionals
to ensure it's at least nil
Rename a tempvar.

Since it's a string, 'type' seemed a little confusing since
it's also used by Mime::Types.  Make it more stringy sounding
Merge branch 'bem-content_type_detection'