ソースを参照

update MIME types

bel 11 年 前
コミット
b9e1cc4fea
1 ファイル変更80 行追加47 行削除
  1. 80 47
      src/civetweb.c

+ 80 - 47
src/civetweb.c

@@ -2203,54 +2203,87 @@ static const struct {
     size_t ext_len;
     const char *mime_type;
 } builtin_mime_types[] = {
-    {".html", 5, "text/html"},
-    {".htm", 4, "text/html"},
-    {".shtm", 5, "text/html"},
-    {".shtml", 6, "text/html"},
-    {".css", 4, "text/css"},
-    {".js",  3, "application/x-javascript"},
-    {".ico", 4, "image/x-icon"},
-    {".gif", 4, "image/gif"},
-    {".jpg", 4, "image/jpeg"},
-    {".jpeg", 5, "image/jpeg"},
-    {".png", 4, "image/png"},
-    {".svg", 4, "image/svg+xml"},
-    {".txt", 4, "text/plain"},
+    // IANA registered MIME types (http://www.iana.org/assignments/media-types)
+    // application types
+    {".doc",     4, "application/msword"},
+    {".eps",     4, "application/postscript"},
+    {".exe",     4, "application/octet-stream"},
+    {".js",      3, "application/javascript"},
+    {".json",    5, "application/json"},
+    {".pdf",     4, "application/pdf"},
+    {".ps",      3, "application/postscript"},
+    {".rtf",     4, "application/rtf"},
+    {".xhtml",   6, "application/xhtml+xml"},
+    {".xsl",     4, "application/xml"},
+    {".xslt",    5, "application/xml"},
+
+    // audio
+    {".mp3",     4, "audio/mpeg"},
+    {".oga",     4, "audio/ogg"},
+    {".ogg",     4, "audio/ogg"},
+
+    // image
+    {".gif",     4, "image/gif"},
+    {".ief",     4, "image/ief"},
+    {".jpeg",    5, "image/jpeg"},
+    {".jpg",     4, "image/jpeg"},
+    {".jpm",     4, "image/jpm"},
+    {".jpx",     4, "image/jpx"},
+    {".png",     4, "image/png"},
+    {".svg",     4, "image/svg+xml"},
+    {".tif",     4, "image/tiff"},
+    {".tiff",    5, "image/tiff"},
+
+    // model
+    {".wrl"      4, "model/vrml"},
+
+    // text
+    {".css",     4, "text/css"},
+    {".csv",     4, "text/csv"},
+    {".htm",     4, "text/html"},
+    {".html",    5, "text/html"},
+    {".sgm",     4, "text/sgml"},
+    {".shtm",    5, "text/html"},
+    {".shtml",   6, "text/html"},
+    {".txt",     4, "text/plain"},
+    {".xml",     4, "text/xml"},
+
+    // video
+    {".mov",     4, "video/quicktime"},
+    {".mp4",     4, "video/mp4"},
+    {".mpeg",    5, "video/mpeg"},
+    {".mpg",     4, "video/mpeg"},
+    {".ogv",     4, "video/ogg"},
+    {".qt",      3, "video/quicktime"},
+
+    // not registered types (http://reference.sitepoint.com/html/mime-types-full, http://www.hansenb.pdx.edu/DMKB/dict/tutorials/mime_typ.php, ..)
+    {".arj",     4, "application/x-arj-compressed"},
+    {".gz",      3, "application/x-gunzip"},
+    {".rar",     4, "application/x-arj-compressed"},
+    {".swf",     4, "application/x-shockwave-flash"},
+    {".tar",     4, "application/x-tar"},
+    {".tgz",     4, "application/x-tar-gz"},
     {".torrent", 8, "application/x-bittorrent"},
-    {".wav", 4, "audio/x-wav"},
-    {".mp3", 4, "audio/x-mp3"},
-    {".mid", 4, "audio/mid"},
-    {".m3u", 4, "audio/x-mpegurl"},
-    {".ogg", 4, "audio/ogg"},
-    {".ram", 4, "audio/x-pn-realaudio"},
-    {".xml", 4, "text/xml"},
-    {".json",  5, "text/json"},
-    {".xslt", 5, "application/xml"},
-    {".xsl", 4, "application/xml"},
-    {".ra",  3, "audio/x-pn-realaudio"},
-    {".doc", 4, "application/msword"},
-    {".exe", 4, "application/octet-stream"},
-    {".zip", 4, "application/x-zip-compressed"},
-    {".xls", 4, "application/excel"},
-    {".tgz", 4, "application/x-tar-gz"},
-    {".tar", 4, "application/x-tar"},
-    {".gz",  3, "application/x-gunzip"},
-    {".arj", 4, "application/x-arj-compressed"},
-    {".rar", 4, "application/x-arj-compressed"},
-    {".rtf", 4, "application/rtf"},
-    {".pdf", 4, "application/pdf"},
-    {".swf", 4, "application/x-shockwave-flash"},
-    {".mpg", 4, "video/mpeg"},
-    {".webm", 5, "video/webm"},
-    {".mpeg", 5, "video/mpeg"},
-    {".mov", 4, "video/quicktime"},
-    {".mp4", 4, "video/mp4"},
-    {".m4v", 4, "video/x-m4v"},
-    {".asf", 4, "video/x-ms-asf"},
-    {".avi", 4, "video/x-msvideo"},
-    {".bmp", 4, "image/bmp"},
-    {".ttf", 4, "application/x-font-ttf"},
-    {NULL,  0, NULL}
+    {".ppt",     4, "application/x-mspowerpoint"},
+    {".xls",     4, "application/x-msexcel"},
+    {".zip",     4, "application/x-zip-compressed"},
+    {".aac",     4, "audio/aac"}, // http://en.wikipedia.org/wiki/Advanced_Audio_Coding
+    {".aif",     4, "audio/x-aif"},
+    {".m3u",     4, "audio/x-mpegurl"},
+    {".mid",     4, "audio/x-midi"},
+    {".ra",      3, "audio/x-pn-realaudio"},
+    {".ram",     4, "audio/x-pn-realaudio"},
+    {".wav",     4, "audio/x-wav"},
+    {".bmp",     4, "image/bmp"},
+    {".ico",     4, "image/x-icon"},
+    {".pct",     4, "image/x-pct"},
+    {".pict",    5, "image/pict"},
+    {".rgb",     4, "image/x-rgb"},
+    {".webm",    5, "video/webm"}, // http://en.wikipedia.org/wiki/WebM
+    {".asf",     4, "video/x-ms-asf"},
+    {".avi",     4, "video/x-msvideo"},
+    {".m4v",     4, "video/x-m4v"},
+    {NULL, 0, NULL}
 };
 
 const char *mg_get_builtin_mime_type(const char *path)