develooper Front page | perl.libwww | Postings from January 2002

LWP::MediaTypes usage for downloads with extension '.hqx'

From:
Norbert Schuler
Date:
January 25, 2002 07:19
Subject:
LWP::MediaTypes usage for downloads with extension '.hqx'
Message ID:
3C5177A0.80709@epublica.de
Hi!

I tried to use LWP::MediaTypes for determing the mime-type of various 
files I offer as downloads and which are sent through a cgi script.

My problem is: The function guess_media_type() within list context 
returns Content-Type "text/plain" and Content-Encoding "x-hqx" for files 
with suffix 'hqx' (with I found is directly implemented in 
MediaTypes.pm). Instead I would prefer the function to return 
Content-Type "application/mac-binhex40" for files with that suffix so 
that Netscape browsers running on windows do not show the files as text 
but offer you to save them to disk.

Is there any reason, why the Content-Encoding ist prefered to the 
Content-Type in function guess_media_type()? My solution now is to 
comment out the line with the Content-Encoding "x-hqx" in MediaTypes.pm 
to make it return the correct Content-Type. Is there a better way?

Norbert
-- 
epublica
Internet-Technologie://Konzeption/Produktion/Wartung

Haus der Multimedia-Produzenten
Behringstra├če 28a / Haus 2
22765 Hamburg

norbert@epublica.de
http://www.epublica.de
Tel.: 040/4109879-2
Fax : 040/4109879-9
Mob.: 0174/9609761




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About