Bug#705473: thttpd: HTTP Header Content-Type: missing MIME detection for 3GP video (and many others)
Package: thttpd
Version: 2.25b-11
Severity: normal
Tags: upstream patch
thttp use the default "text/plain;" Content-Type: header for many files
types, including 3GP ones. So mobile phones fail to read 3GP videos
served by thttpd.
Always reproductible :
* setup a default thttpd server
* put a .3gp in served documentroot
* try to GET it via HTTP client.
HTTP header will contain "Content-Type: text/plain;" and is not correct.
MIME type detection is done with file extension in thttpd, based on a
fixed list at compile time and 3gp extension entry is missing.
Attached : a patch that add file extensions present in
/etc/mime.types from package mime-support 3.48-1 and are missing in
thttpd fixed list. I am not including extensions that have a MIME type
contianing an "x-" prefix (ie non standardised).
-- System Information:
Debian Release: 6.0.7
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages thttpd depends on:
ii libc6 2.11.3-4 Embedded GNU C Library: Shared lib
Versions of packages thttpd recommends:
ii logrotate 3.7.8-6 Log rotation utility
Versions of packages thttpd suggests:
pn thttpd-util <none> (no description available)
-- Configuration Files:
/etc/default/thttpd changed:
ENABLED=yes
/etc/thttpd/thttpd.conf changed:
port=8080
dir=/var/www2
chroot
user=www-data
cgipat=/cgi-bin/*
throttles=/etc/thttpd/throttle.conf
logfile=/var/log/thttpd.log
-- no debconf information
#! /bin/sh /usr/share/dpatch/dpatch-run
## 13-extra-mimetypes.dpatch by <root@sd-30464.dedibox.fr>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
@DPATCH@
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' thttpd-2.25b~/mime_types.txt thttpd-2.25b/mime_types.txt
--- thttpd-2.25b~/mime_types.txt 2013-04-12 16:52:57.332789434 +0200
+++ thttpd-2.25b/mime_types.txt 2013-04-12 16:52:57.364732735 +0200
@@ -3,115 +3,197 @@
# A list of file extensions followed by the corresponding MIME type.
# Extensions not found in the table are returned as text/plain.
-a application/octet-stream
+323 text/h323
+3gp video/3gpp
aab application/x-authorware-bin
aam application/x-authorware-map
+a application/octet-stream
aas application/x-authorware-seg
ai application/postscript
aif audio/x-aiff
aifc audio/x-aiff
aiff audio/x-aiff
+amr audio/amr
+anx application/annodex
+apk application/vnd.android.package-archive
asc text/plain
asf video/x-ms-asf
asx video/x-ms-asf
+atom application/atom+xml
+atomcat application/atomcat+xml
+atomsrv application/atomserv+xml
au audio/basic
avi video/x-msvideo
+awb audio/amr-wb
+axa audio/annodex
+axv video/annodex
bcpio application/x-bcpio
bin application/octet-stream
bmp image/bmp
+brf text/plain
+cap application/cap
+cat application/vnd.ms-pki.seccat
cdf application/x-netcdf
+cdy application/vnd.cinderella
+class application/java-vm
class application/x-java-vm
+cod application/vnd.rim.cod
cpio application/x-cpio
cpt application/mac-compactpro
crl application/x-pkcs7-crl
crt application/x-x509-ca-cert
csh application/x-csh
css text/css
+csv text/csv
+cu application/cu-seeme
+davmount application/davmount+xml
dcr application/x-director
+dif video/dv
dir application/x-director
djv image/vnd.djvu
djvu image/vnd.djvu
dll application/octet-stream
+dl video/dl
dms application/octet-stream
doc application/msword
+docx application/vnd.openxmlformats-officedocument.wordprocessingml.document
+dot application/msword
+dotx application/vnd.openxmlformats-officedocument.wordprocessingml.template
dtd text/xml
dump application/octet-stream
dvi application/x-dvi
+dv video/dv
dxr application/x-director
+eml message/rfc822
+eps2 application/postscript
+eps3 application/postscript
eps application/postscript
+epsf application/postscript
+epsi application/postscript
+es application/ecmascript
etx text/x-setext
exe application/octet-stream
ez application/andrew-inset
fgd application/x-director
-fh image/x-freehand
fh4 image/x-freehand
fh5 image/x-freehand
fh7 image/x-freehand
fhc image/x-freehand
+fh image/x-freehand
+flac audio/flac
+fli video/fli
gif image/gif
+gl video/gl
gtar application/x-gtar
hdf application/x-hdf
hqx application/mac-binhex40
-htm text/html; charset=%s
+hta application/hta
html text/html; charset=%s
+htm text/html; charset=%s
ice x-conference/x-cooltalk
+ics text/calendar
+icz text/calendar
ief image/ief
iges model/iges
igs model/iges
iv application/x-inventor
+jad text/vnd.sun.j2me.app-descriptor
+jar application/java-archive
jar application/x-java-archive
jfif image/jpeg
-jpe image/jpeg
jpeg image/jpeg
+jpe image/jpeg
jpg image/jpeg
+js application/javascript
js application/x-javascript
kar audio/midi
+key application/pgp-keys
+kml application/vnd.google-earth.kml+xml
+kmz application/vnd.google-earth.kmz
latex application/x-latex
lha application/octet-stream
+lin application/bbolin
lzh application/octet-stream
+m3g application/m3g
+m3u audio/mpegurl
m3u audio/x-mpegurl
+m4a audio/mpeg
man application/x-troff-man
+manifest text/cache-manifest
mathml application/mathml+xml
+mdb application/msaccess
me application/x-troff-me
mesh model/mesh
mid audio/midi
midi audio/midi
mif application/vnd.mif
mime message/rfc822
+mmf application/vnd.smaf
mml application/mathml+xml
-mov video/quicktime
+mml text/mathml
movie video/x-sgi-movie
+mov video/quicktime
mp2 audio/mpeg
mp3 audio/mpeg
mp4 video/mp4
-mpe video/mpeg
+mpega audio/mpeg
mpeg video/mpeg
-mpg video/mpeg
+mpe video/mpeg
mpga audio/mpeg
+mpg video/mpeg
ms application/x-troff-ms
msh model/mesh
mv video/x-sgi-movie
+mxf application/mxf
mxu video/vnd.mpegurl
+nb application/mathematica
+nbp application/mathematica
nc application/x-netcdf
o application/octet-stream
oda application/oda
+odb application/vnd.oasis.opendocument.database
+odc application/vnd.oasis.opendocument.chart
+odf application/vnd.oasis.opendocument.formula
+odg application/vnd.oasis.opendocument.graphics
+odi application/vnd.oasis.opendocument.image
+odm application/vnd.oasis.opendocument.text-master
+odp application/vnd.oasis.opendocument.presentation
+ods application/vnd.oasis.opendocument.spreadsheet
+odt application/vnd.oasis.opendocument.text
+oga audio/ogg
ogg application/x-ogg
+ogg audio/ogg
ogv video/ogg
ogx application/ogg
+otg application/vnd.oasis.opendocument.graphics-template
+oth application/vnd.oasis.opendocument.text-web
+otp application/vnd.oasis.opendocument.presentation-template
+ots application/vnd.oasis.opendocument.spreadsheet-template
+ott application/vnd.oasis.opendocument.text-template
pac application/x-ns-proxy-autoconfig
pbm image/x-portable-bitmap
+pcap application/cap
+pcx image/pcx
pdb chemical/x-pdb
pdf application/pdf
pgm image/x-portable-graymap
pgn application/x-chess-pgn
+pgp application/pgp-signature
png image/png
pnm image/x-portable-anymap
+pot text/plain
+potx application/vnd.openxmlformats-officedocument.presentationml.template
ppm image/x-portable-pixmap
+pps application/vnd.ms-powerpoint
+ppsx application/vnd.openxmlformats-officedocument.presentationml.slideshow
ppt application/vnd.ms-powerpoint
+pptx application/vnd.openxmlformats-officedocument.presentationml.presentation
+prf application/pics-rules
ps application/postscript
qt video/quicktime
ra audio/x-realaudio
ram audio/x-pn-realaudio
+rar application/rar
ras image/x-cmu-raster
rdf application/rdf+xml
rgb image/x-rgb
@@ -119,13 +201,26 @@
roff application/x-troff
rpm audio/x-pn-realaudio-plugin
rss application/rss+xml
+rtf application/rtf
rtf text/rtf
rtx text/richtext
-sgm text/sgml
+sct text/scriptlet
+sda application/vnd.stardivision.draw
+sdc application/vnd.stardivision.calc
+sdd application/vnd.stardivision.impress
+sdf application/vnd.stardivision.math
+sds application/vnd.stardivision.chart
+sdw application/vnd.stardivision.writer
+ser application/java-serialized-object
+sgl application/vnd.stardivision.writer-global
sgml text/sgml
+sgm text/sgml
sh application/x-sh
shar application/x-shar
+shtml text/html
+sid audio/prs.sid
silo model/mesh
+sis application/vnd.symbian.install
sit application/x-stuffit
skd application/x-koan
skm application/x-koan
@@ -135,11 +230,14 @@
smil application/smil
snd audio/basic
so application/octet-stream
+spl application/futuresplash
spl application/x-futuresplash
+spx audio/ogg
src application/x-wais-source
stc application/vnd.sun.xml.calc.template
std application/vnd.sun.xml.draw.template
sti application/vnd.sun.xml.impress.template
+stl application/vnd.ms-pki.stl
stw application/vnd.sun.xml.writer.template
sv4cpio application/x-sv4cpio
sv4crc application/x-sv4crc
@@ -158,40 +256,61 @@
tex application/x-tex
texi application/x-texinfo
texinfo application/x-texinfo
-tif image/tiff
+text text/plain
tiff image/tiff
+tif image/tiff
+tm text/texmacs
tr application/x-troff
tsp application/dsptype
+ts text/texmacs
tsv text/tab-separated-values
+txt text/plain
txt text/plain; charset=%s
+uls text/iuls
ustar application/x-ustar
vcd application/x-cdlink
vrml model/vrml
+vsd application/vnd.visio
vx video/x-rad-screenplay
wav audio/x-wav
wax audio/x-ms-wax
wbmp image/vnd.wap.wbmp
wbxml application/vnd.wap.wbxml
-wm video/x-ms-wm
wma audio/x-ms-wma
wmd application/x-ms-wmd
-wml text/vnd.wap.wml
wmlc application/vnd.wap.wmlc
-wmls text/vnd.wap.wmlscript
wmlsc application/vnd.wap.wmlscriptc
+wmls text/vnd.wap.wmlscript
+wml text/vnd.wap.wml
+wm video/x-ms-wm
wmv video/x-ms-wmv
wmx video/x-ms-wmx
wmz application/x-ms-wmz
+wp5 application/vnd.wordperfect5.1
+wpd application/vnd.wordperfect
wrl model/vrml
+wsc text/scriptlet
wsrc application/x-wais-source
wvx video/x-ms-wvx
+x3db model/x3d+binary
+x3d model/x3d+xml
+x3dv model/x3d+vrml
xbm image/x-xbitmap
xht application/xhtml+xml
xhtml application/xhtml+xml
+xlb application/vnd.ms-excel
xls application/vnd.ms-excel
+xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
+xlt application/vnd.ms-excel
+xltx application/vnd.openxmlformats-officedocument.spreadsheetml.template
+xml application/xml
xml text/xml
xpm image/x-xpixmap
+xsd application/xml
+xsl application/xml
xsl text/xml
+xspf application/xspf+xml
+xul application/vnd.mozilla.xul+xml
xwd image/x-xwindowdump
xyz chemical/x-xyz
zip application/zip
Reply to: