[geeky] odd Firefox/Safari bug
Aug. 20th, 2005 12:34 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
At work our end users can download their voicemail from our web site. We use CGI scripts to authenticate them and send them the voicemail message. One user reported last week that he was unable to get either Firefox (Mac) or Safari to play his voicemail.
It appears, from the testing I have done with Firefox on Linux, that if the message type isn't natively supported in the browser -- i.e. the browser has to spawn an external application -- then Firefox essentially ignores the MIME type in the HTTP headers and tries to figure out what to do with the file based on the filename extension in the URL.
Observe:
http://www.unchi.org/~twp/sendjpg.cgi
This is a shell script that prints "Content-Type: image/jpeg" and then displays an image of yours truly. When I go to this URL I get a picture of my shining face.
However:
http://www.unchi.org/~twp/sendwav.cgi
This is a shell script that prints "Content-Type: audio/x-wav" and then sends a .WAV file of Morgan (age 2.5) saying "apple." When I visit this URL, Firefox announces that I am trying to download a file called "sendwav.cgi", which is of type "CGI script," and asks me what application I want to use to open it. No hint that it's an audio file.
Very odd. I can't find any reference to this quickly by Googling. Anyone else ever seen it before? IE appears to do the right thing, ironically enough.
It appears, from the testing I have done with Firefox on Linux, that if the message type isn't natively supported in the browser -- i.e. the browser has to spawn an external application -- then Firefox essentially ignores the MIME type in the HTTP headers and tries to figure out what to do with the file based on the filename extension in the URL.
Observe:
http://www.unchi.org/~twp/sendjpg.cgi
This is a shell script that prints "Content-Type: image/jpeg" and then displays an image of yours truly. When I go to this URL I get a picture of my shining face.
However:
http://www.unchi.org/~twp/sendwav.cgi
This is a shell script that prints "Content-Type: audio/x-wav" and then sends a .WAV file of Morgan (age 2.5) saying "apple." When I visit this URL, Firefox announces that I am trying to download a file called "sendwav.cgi", which is of type "CGI script," and asks me what application I want to use to open it. No hint that it's an audio file.
Very odd. I can't find any reference to this quickly by Googling. Anyone else ever seen it before? IE appears to do the right thing, ironically enough.
no subject
Date: 2005-08-20 06:11 pm (UTC)no subject
Date: 2005-08-20 06:24 pm (UTC)no subject
Date: 2005-08-20 07:32 pm (UTC)no subject
Date: 2005-08-20 07:35 pm (UTC)no subject
Date: 2005-08-20 06:50 pm (UTC)But the CGI which points me at the WAV file creates a pop-up with the phrase "Opening sendwav.cgi" on the title bar. The text of the pop-up says:
Then, when I try to play it in RealPlayer, it informs me that it doesn't have the CGI plug-in.
IE does the right thing because it comes automatically pre-bloated.
no subject
Date: 2005-08-21 12:04 am (UTC)no subject
Date: 2005-08-21 01:38 am (UTC)I'm doing your homework on a Saturday night
Date: 2005-08-21 03:50 am (UTC)1. You don't have a plug-in installed for audio/x-wav. So Firefox looks for an external player. It does this by checking out good old /etc/mailcap. /etc/mailcap has an entry for audio/*, mapped to "play"... but this entry is commented out, with a note saying that play is apparently a security hole.
2. Firefox gives up and generates a "what would you like to do with this weird shit" message, apparently consulting an internal table of pretty names for various file extensions simply to come up with a more educated guess to help you pick a program. Why it does not consult an internal table of pretty names for common MIME types instead is anybody's guess. However, this does not matter, because...
3. When I uncomment the entry for audio/* in /etc/mailcap, I get an entirely different prompt which correctly recognizes that the file is a WAV file and offers to play it with 'play'.
So: if your system *has* a registered player for audio/x-wav, whether in /etc/mailcap or via a Firefox plug-in (try Plugger, etc), everything will work just fine. You and your end user are only having trouble because Fedora/Red Hat (and perhaps others), in their infinite wisdom, shut off the only default player for audio files in /etc/mailcap without offering any alternative.
Ahhh, that was better than counting sheep! Nighty night now.
no subject
Date: 2006-06-11 02:32 pm (UTC)