1 /** 2 Maps file name extensions to standard mime types. 3 4 Copyright: © 2012 Sönke Ludwig 5 License: Subject to the terms of the MIT license, as written in the included LICENSE.txt file. 6 Authors: Sönke Ludwig 7 */ 8 module vibe.inet.mimetypes; 9 10 import std.path; 11 import std.string; 12 13 14 /** 15 Returns the standard mime type for the extension of the specified file name. 16 17 Any unknown file extension will map to "application/octet-stream". 18 */ 19 string getMimeTypeForFile(string filename) 20 @safe pure 21 { 22 string ext = extension(filename); 23 if( ext.length == 0 ) return "application/octet-stream"; 24 25 assert(ext[0] == '.'); 26 27 switch (toLower(ext[1 .. $])) { 28 default: return "application/octet-stream"; 29 case "ez": return "application/andrew-inset"; 30 case "aw": return "application/applixware"; 31 case "atom": return "application/atom+xml"; 32 case "atomcat": return "application/atomcat+xml"; 33 case "atomsvc": return "application/atomsvc+xml"; 34 case "ccxml": return "application/ccxml+xml"; 35 case "cdmia": return "application/cdmi-capability"; 36 case "cdmic": return "application/cdmi-container"; 37 case "cdmid": return "application/cdmi-domain"; 38 case "cdmio": return "application/cdmi-object"; 39 case "cdmiq": return "application/cdmi-queue"; 40 case "cu": return "application/cu-seeme"; 41 case "davmount": return "application/davmount+xml"; 42 case "dssc": return "application/dssc+der"; 43 case "xdssc": return "application/dssc+xml"; 44 case "ecma": return "application/ecmascript"; 45 case "emma": return "application/emma+xml"; 46 case "epub": return "application/epub+zip"; 47 case "exi": return "application/exi"; 48 case "pfr": return "application/font-tdpfr"; 49 case "stk": return "application/hyperstudio"; 50 case "ink","inkml": return "application/inkml+xml"; 51 case "ipfix": return "application/ipfix"; 52 case "jar": return "application/java-archive"; 53 case "ser": return "application/java-serialized-object"; 54 case "class": return "application/java-vm"; 55 case "js": return "application/javascript"; 56 case "json": return "application/json"; 57 case "lostxml": return "application/lost+xml"; 58 case "hqx": return "application/mac-binhex40"; 59 case "cpt": return "application/mac-compactpro"; 60 case "mads": return "application/mads+xml"; 61 case "mrc": return "application/marc"; 62 case "mrcx": return "application/marcxml+xml"; 63 case "ma","nb","mb": return "application/mathematica"; 64 case "mathml": return "application/mathml+xml"; 65 case "mbox": return "application/mbox"; 66 case "mscml": return "application/mediaservercontrol+xml"; 67 case "meta4": return "application/metalink4+xml"; 68 case "mets": return "application/mets+xml"; 69 case "mods": return "application/mods+xml"; 70 case "m21","mp21": return "application/mp21"; 71 case "mp4s": return "application/mp4"; 72 case "doc","dot": return "application/msword"; 73 case "mxf": return "application/mxf"; 74 case "bin","dms","lha","lrf","lzh","so","iso","dmg","dist","distz","pkg","bpk","dump","elc","deploy": return "application/octet-stream"; 75 case "oda": return "application/oda"; 76 case "opf": return "application/oebps-package+xml"; 77 case "ogx": return "application/ogg"; 78 case "onetoc","onetoc2","onetmp","onepkg": return "application/onenote"; 79 case "oxps": return "application/oxps"; 80 case "xer": return "application/patch-ops-error+xml"; 81 case "pdf": return "application/pdf"; 82 case "pgp": return "application/pgp-encrypted"; 83 case "asc","sig": return "application/pgp-signature"; 84 case "prf": return "application/pics-rules"; 85 case "p10": return "application/pkcs10"; 86 case "p7m","p7c": return "application/pkcs7-mime"; 87 case "p7s": return "application/pkcs7-signature"; 88 case "p8": return "application/pkcs8"; 89 case "ac": return "application/pkix-attr-cert"; 90 case "cer": return "application/pkix-cert"; 91 case "crl": return "application/pkix-crl"; 92 case "pkipath": return "application/pkix-pkipath"; 93 case "pki": return "application/pkixcmp"; 94 case "pls": return "application/pls+xml"; 95 case "ai","eps","ps": return "application/postscript"; 96 case "cww": return "application/prs.cww"; 97 case "pskcxml": return "application/pskc+xml"; 98 case "rdf": return "application/rdf+xml"; 99 case "rif": return "application/reginfo+xml"; 100 case "rnc": return "application/relax-ng-compact-syntax"; 101 case "rl": return "application/resource-lists+xml"; 102 case "rld": return "application/resource-lists-diff+xml"; 103 case "rs": return "application/rls-services+xml"; 104 case "gbr": return "application/rpki-ghostbusters"; 105 case "mft": return "application/rpki-manifest"; 106 case "roa": return "application/rpki-roa"; 107 case "rsd": return "application/rsd+xml"; 108 case "rss": return "application/rss+xml"; 109 case "rtf": return "application/rtf"; 110 case "sbml": return "application/sbml+xml"; 111 case "scq": return "application/scvp-cv-request"; 112 case "scs": return "application/scvp-cv-response"; 113 case "spq": return "application/scvp-vp-request"; 114 case "spp": return "application/scvp-vp-response"; 115 case "sdp": return "application/sdp"; 116 case "setpay": return "application/set-payment-initiation"; 117 case "setreg": return "application/set-registration-initiation"; 118 case "shf": return "application/shf+xml"; 119 case "smi","smil": return "application/smil+xml"; 120 case "rq": return "application/sparql-query"; 121 case "srx": return "application/sparql-results+xml"; 122 case "gram": return "application/srgs"; 123 case "grxml": return "application/srgs+xml"; 124 case "sru": return "application/sru+xml"; 125 case "ssml": return "application/ssml+xml"; 126 case "sqlite","s3db","db3": return "application/x-sqlite3"; 127 case "tei","teicorpus": return "application/tei+xml"; 128 case "tfi": return "application/thraud+xml"; 129 case "tsd": return "application/timestamped-data"; 130 case "plb": return "application/vnd.3gpp.pic-bw-large"; 131 case "psb": return "application/vnd.3gpp.pic-bw-small"; 132 case "pvb": return "application/vnd.3gpp.pic-bw-var"; 133 case "tcap": return "application/vnd.3gpp2.tcap"; 134 case "pwn": return "application/vnd.3m.post-it-notes"; 135 case "aso": return "application/vnd.accpac.simply.aso"; 136 case "imp": return "application/vnd.accpac.simply.imp"; 137 case "acu": return "application/vnd.acucobol"; 138 case "atc","acutc": return "application/vnd.acucorp"; 139 case "air": return "application/vnd.adobe.air-application-installer-package+zip"; 140 case "fxp","fxpl": return "application/vnd.adobe.fxp"; 141 case "xdp": return "application/vnd.adobe.xdp+xml"; 142 case "xfdf": return "application/vnd.adobe.xfdf"; 143 case "ahead": return "application/vnd.ahead.space"; 144 case "azf": return "application/vnd.airzip.filesecure.azf"; 145 case "azs": return "application/vnd.airzip.filesecure.azs"; 146 case "azw": return "application/vnd.amazon.ebook"; 147 case "acc": return "application/vnd.americandynamics.acc"; 148 case "ami": return "application/vnd.amiga.ami"; 149 case "apk": return "application/vnd.android.package-archive"; 150 case "cii": return "application/vnd.anser-web-certificate-issue-initiation"; 151 case "fti": return "application/vnd.anser-web-funds-transfer-initiation"; 152 case "atx": return "application/vnd.antix.game-component"; 153 case "mpkg": return "application/vnd.apple.installer+xml"; 154 case "m3u8": return "application/vnd.apple.mpegurl"; 155 case "swi": return "application/vnd.aristanetworks.swi"; 156 case "iota": return "application/vnd.astraea-software.iota"; 157 case "aep": return "application/vnd.audiograph"; 158 case "mpm": return "application/vnd.blueice.multipass"; 159 case "bmi": return "application/vnd.bmi"; 160 case "rep": return "application/vnd.businessobjects"; 161 case "cdxml": return "application/vnd.chemdraw+xml"; 162 case "mmd": return "application/vnd.chipnuts.karaoke-mmd"; 163 case "cdy": return "application/vnd.cinderella"; 164 case "cla": return "application/vnd.claymore"; 165 case "rp9": return "application/vnd.cloanto.rp9"; 166 case "c4g","c4d","c4f","c4p","c4u": return "application/vnd.clonk.c4group"; 167 case "c11amc": return "application/vnd.cluetrust.cartomobile-config"; 168 case "c11amz": return "application/vnd.cluetrust.cartomobile-config-pkg"; 169 case "csp": return "application/vnd.commonspace"; 170 case "cdbcmsg": return "application/vnd.contact.cmsg"; 171 case "cmc": return "application/vnd.cosmocaller"; 172 case "clkx": return "application/vnd.crick.clicker"; 173 case "clkk": return "application/vnd.crick.clicker.keyboard"; 174 case "clkp": return "application/vnd.crick.clicker.palette"; 175 case "clkt": return "application/vnd.crick.clicker.template"; 176 case "clkw": return "application/vnd.crick.clicker.wordbank"; 177 case "wbs": return "application/vnd.criticaltools.wbs+xml"; 178 case "pml": return "application/vnd.ctc-posml"; 179 case "ppd": return "application/vnd.cups-ppd"; 180 case "car": return "application/vnd.curl.car"; 181 case "pcurl": return "application/vnd.curl.pcurl"; 182 case "rdz": return "application/vnd.data-vision.rdz"; 183 case "uvf","uvvf","uvd","uvvd": return "application/vnd.dece.data"; 184 case "uvt","uvvt": return "application/vnd.dece.ttml+xml"; 185 case "uvx","uvvx": return "application/vnd.dece.unspecified"; 186 case "uvz","uvvz": return "application/vnd.dece.zip"; 187 case "fe_launch": return "application/vnd.denovo.fcselayout-link"; 188 case "dna": return "application/vnd.dna"; 189 case "mlp": return "application/vnd.dolby.mlp"; 190 case "dpg": return "application/vnd.dpgraph"; 191 case "dfac": return "application/vnd.dreamfactory"; 192 case "ait": return "application/vnd.dvb.ait"; 193 case "svc": return "application/vnd.dvb.service"; 194 case "geo": return "application/vnd.dynageo"; 195 case "mag": return "application/vnd.ecowin.chart"; 196 case "nml": return "application/vnd.enliven"; 197 case "esf": return "application/vnd.epson.esf"; 198 case "msf": return "application/vnd.epson.msf"; 199 case "qam": return "application/vnd.epson.quickanime"; 200 case "slt": return "application/vnd.epson.salt"; 201 case "ssf": return "application/vnd.epson.ssf"; 202 case "es3","et3": return "application/vnd.eszigno3+xml"; 203 case "ez2": return "application/vnd.ezpix-album"; 204 case "ez3": return "application/vnd.ezpix-package"; 205 case "fdf": return "application/vnd.fdf"; 206 case "mseed": return "application/vnd.fdsn.mseed"; 207 case "seed","dataless": return "application/vnd.fdsn.seed"; 208 case "gph": return "application/vnd.flographit"; 209 case "ftc": return "application/vnd.fluxtime.clip"; 210 case "fm","frame","maker","book": return "application/vnd.framemaker"; 211 case "fnc": return "application/vnd.frogans.fnc"; 212 case "ltf": return "application/vnd.frogans.ltf"; 213 case "fsc": return "application/vnd.fsc.weblaunch"; 214 case "oas": return "application/vnd.fujitsu.oasys"; 215 case "oa2": return "application/vnd.fujitsu.oasys2"; 216 case "oa3": return "application/vnd.fujitsu.oasys3"; 217 case "fg5": return "application/vnd.fujitsu.oasysgp"; 218 case "bh2": return "application/vnd.fujitsu.oasysprs"; 219 case "ddd": return "application/vnd.fujixerox.ddd"; 220 case "xdw": return "application/vnd.fujixerox.docuworks"; 221 case "xbd": return "application/vnd.fujixerox.docuworks.binder"; 222 case "fzs": return "application/vnd.fuzzysheet"; 223 case "txd": return "application/vnd.genomatix.tuxedo"; 224 case "ggb": return "application/vnd.geogebra.file"; 225 case "ggt": return "application/vnd.geogebra.tool"; 226 case "gex","gre": return "application/vnd.geometry-explorer"; 227 case "gxt": return "application/vnd.geonext"; 228 case "g2w": return "application/vnd.geoplan"; 229 case "g3w": return "application/vnd.geospace"; 230 case "gmx": return "application/vnd.gmx"; 231 case "kml": return "application/vnd.google-earth.kml+xml"; 232 case "kmz": return "application/vnd.google-earth.kmz"; 233 case "gqf","gqs": return "application/vnd.grafeq"; 234 case "gac": return "application/vnd.groove-account"; 235 case "ghf": return "application/vnd.groove-help"; 236 case "gim": return "application/vnd.groove-identity-message"; 237 case "grv": return "application/vnd.groove-injector"; 238 case "gtm": return "application/vnd.groove-tool-message"; 239 case "tpl": return "application/vnd.groove-tool-template"; 240 case "vcg": return "application/vnd.groove-vcard"; 241 case "hal": return "application/vnd.hal+xml"; 242 case "zmm": return "application/vnd.handheld-entertainment+xml"; 243 case "hbci": return "application/vnd.hbci"; 244 case "les": return "application/vnd.hhe.lesson-player"; 245 case "hpgl": return "application/vnd.hp-hpgl"; 246 case "hpid": return "application/vnd.hp-hpid"; 247 case "hps": return "application/vnd.hp-hps"; 248 case "jlt": return "application/vnd.hp-jlyt"; 249 case "pcl": return "application/vnd.hp-pcl"; 250 case "pclxl": return "application/vnd.hp-pclxl"; 251 case "sfd-hdstx": return "application/vnd.hydrostatix.sof-data"; 252 case "x3d": return "application/vnd.hzn-3d-crossword"; 253 case "mpy": return "application/vnd.ibm.minipay"; 254 case "afp","listafp","list3820": return "application/vnd.ibm.modcap"; 255 case "irm": return "application/vnd.ibm.rights-management"; 256 case "sc": return "application/vnd.ibm.secure-container"; 257 case "icc","icm": return "application/vnd.iccprofile"; 258 case "igl": return "application/vnd.igloader"; 259 case "ivp": return "application/vnd.immervision-ivp"; 260 case "ivu": return "application/vnd.immervision-ivu"; 261 case "igm": return "application/vnd.insors.igm"; 262 case "xpw","xpx": return "application/vnd.intercon.formnet"; 263 case "i2g": return "application/vnd.intergeo"; 264 case "qbo": return "application/vnd.intu.qbo"; 265 case "qfx": return "application/vnd.intu.qfx"; 266 case "rcprofile": return "application/vnd.ipunplugged.rcprofile"; 267 case "irp": return "application/vnd.irepository.package+xml"; 268 case "xpr": return "application/vnd.is-xpr"; 269 case "fcs": return "application/vnd.isac.fcs"; 270 case "jam": return "application/vnd.jam"; 271 case "rms": return "application/vnd.jcp.javame.midlet-rms"; 272 case "jisp": return "application/vnd.jisp"; 273 case "joda": return "application/vnd.joost.joda-archive"; 274 case "ktz","ktr": return "application/vnd.kahootz"; 275 case "karbon": return "application/vnd.kde.karbon"; 276 case "chrt": return "application/vnd.kde.kchart"; 277 case "kfo": return "application/vnd.kde.kformula"; 278 case "flw": return "application/vnd.kde.kivio"; 279 case "kon": return "application/vnd.kde.kontour"; 280 case "kpr","kpt": return "application/vnd.kde.kpresenter"; 281 case "ksp": return "application/vnd.kde.kspread"; 282 case "kwd","kwt": return "application/vnd.kde.kword"; 283 case "htke": return "application/vnd.kenameaapp"; 284 case "kia": return "application/vnd.kidspiration"; 285 case "kne","knp": return "application/vnd.kinar"; 286 case "skp","skd","skt","skm": return "application/vnd.koan"; 287 case "sse": return "application/vnd.kodak-descriptor"; 288 case "lasxml": return "application/vnd.las.las+xml"; 289 case "lbd": return "application/vnd.llamagraphics.life-balance.desktop"; 290 case "lbe": return "application/vnd.llamagraphics.life-balance.exchange+xml"; 291 case "123": return "application/vnd.lotus-1-2-3"; 292 case "apr": return "application/vnd.lotus-approach"; 293 case "pre": return "application/vnd.lotus-freelance"; 294 case "nsf": return "application/vnd.lotus-notes"; 295 case "org": return "application/vnd.lotus-organizer"; 296 case "scm": return "application/vnd.lotus-screencam"; 297 case "lwp": return "application/vnd.lotus-wordpro"; 298 case "portpkg": return "application/vnd.macports.portpkg"; 299 case "mcd": return "application/vnd.mcd"; 300 case "mc1": return "application/vnd.medcalcdata"; 301 case "cdkey": return "application/vnd.mediastation.cdkey"; 302 case "mwf": return "application/vnd.mfer"; 303 case "mfm": return "application/vnd.mfmp"; 304 case "flo": return "application/vnd.micrografx.flo"; 305 case "igx": return "application/vnd.micrografx.igx"; 306 case "mif": return "application/vnd.mif"; 307 case "daf": return "application/vnd.mobius.daf"; 308 case "dis": return "application/vnd.mobius.dis"; 309 case "mbk": return "application/vnd.mobius.mbk"; 310 case "mqy": return "application/vnd.mobius.mqy"; 311 case "msl": return "application/vnd.mobius.msl"; 312 case "plc": return "application/vnd.mobius.plc"; 313 case "txf": return "application/vnd.mobius.txf"; 314 case "mpn": return "application/vnd.mophun.application"; 315 case "mpc": return "application/vnd.mophun.certificate"; 316 case "xul": return "application/vnd.mozilla.xul+xml"; 317 case "cil": return "application/vnd.ms-artgalry"; 318 case "cab": return "application/vnd.ms-cab-compressed"; 319 case "xls","xlm","xla","xlc","xlt","xlw": return "application/vnd.ms-excel"; 320 case "xlam": return "application/vnd.ms-excel.addin.macroenabled.12"; 321 case "xlsb": return "application/vnd.ms-excel.sheet.binary.macroenabled.12"; 322 case "xlsm": return "application/vnd.ms-excel.sheet.macroenabled.12"; 323 case "xltm": return "application/vnd.ms-excel.template.macroenabled.12"; 324 case "eot": return "application/vnd.ms-fontobject"; 325 case "chm": return "application/vnd.ms-htmlhelp"; 326 case "ims": return "application/vnd.ms-ims"; 327 case "lrm": return "application/vnd.ms-lrm"; 328 case "thmx": return "application/vnd.ms-officetheme"; 329 case "cat": return "application/vnd.ms-pki.seccat"; 330 case "stl": return "application/vnd.ms-pki.stl"; 331 case "ppt","pps","pot": return "application/vnd.ms-powerpoint"; 332 case "ppam": return "application/vnd.ms-powerpoint.addin.macroenabled.12"; 333 case "pptm": return "application/vnd.ms-powerpoint.presentation.macroenabled.12"; 334 case "sldm": return "application/vnd.ms-powerpoint.slide.macroenabled.12"; 335 case "ppsm": return "application/vnd.ms-powerpoint.slideshow.macroenabled.12"; 336 case "potm": return "application/vnd.ms-powerpoint.template.macroenabled.12"; 337 case "mpp","mpt": return "application/vnd.ms-project"; 338 case "docm": return "application/vnd.ms-word.document.macroenabled.12"; 339 case "dotm": return "application/vnd.ms-word.template.macroenabled.12"; 340 case "wps","wks","wcm","wdb": return "application/vnd.ms-works"; 341 case "wpl": return "application/vnd.ms-wpl"; 342 case "xps": return "application/vnd.ms-xpsdocument"; 343 case "mseq": return "application/vnd.mseq"; 344 case "mus": return "application/vnd.musician"; 345 case "msty": return "application/vnd.muvee.style"; 346 case "taglet": return "application/vnd.mynfc"; 347 case "nlu": return "application/vnd.neurolanguage.nlu"; 348 case "nnd": return "application/vnd.noblenet-directory"; 349 case "nns": return "application/vnd.noblenet-sealer"; 350 case "nnw": return "application/vnd.noblenet-web"; 351 case "ngdat": return "application/vnd.nokia.n-gage.data"; 352 case "n-gage": return "application/vnd.nokia.n-gage.symbian.install"; 353 case "rpst": return "application/vnd.nokia.radio-preset"; 354 case "rpss": return "application/vnd.nokia.radio-presets"; 355 case "edm": return "application/vnd.novadigm.edm"; 356 case "edx": return "application/vnd.novadigm.edx"; 357 case "ext": return "application/vnd.novadigm.ext"; 358 case "odc": return "application/vnd.oasis.opendocument.chart"; 359 case "otc": return "application/vnd.oasis.opendocument.chart-template"; 360 case "odb": return "application/vnd.oasis.opendocument.database"; 361 case "odf": return "application/vnd.oasis.opendocument.formula"; 362 case "odft": return "application/vnd.oasis.opendocument.formula-template"; 363 case "odg": return "application/vnd.oasis.opendocument.graphics"; 364 case "otg": return "application/vnd.oasis.opendocument.graphics-template"; 365 case "odi": return "application/vnd.oasis.opendocument.image"; 366 case "oti": return "application/vnd.oasis.opendocument.image-template"; 367 case "odp": return "application/vnd.oasis.opendocument.presentation"; 368 case "otp": return "application/vnd.oasis.opendocument.presentation-template"; 369 case "ods": return "application/vnd.oasis.opendocument.spreadsheet"; 370 case "ots": return "application/vnd.oasis.opendocument.spreadsheet-template"; 371 case "odt": return "application/vnd.oasis.opendocument.text"; 372 case "odm": return "application/vnd.oasis.opendocument.text-master"; 373 case "ott": return "application/vnd.oasis.opendocument.text-template"; 374 case "oth": return "application/vnd.oasis.opendocument.text-web"; 375 case "xo": return "application/vnd.olpc-sugar"; 376 case "dd2": return "application/vnd.oma.dd2+xml"; 377 case "oxt": return "application/vnd.openofficeorg.extension"; 378 case "pptx": return "application/vnd.openxmlformats-officedocument.presentationml.presentation"; 379 case "sldx": return "application/vnd.openxmlformats-officedocument.presentationml.slide"; 380 case "ppsx": return "application/vnd.openxmlformats-officedocument.presentationml.slideshow"; 381 case "potx": return "application/vnd.openxmlformats-officedocument.presentationml.template"; 382 case "xlsx": return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; 383 case "xltx": return "application/vnd.openxmlformats-officedocument.spreadsheetml.template"; 384 case "docx": return "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; 385 case "dotx": return "application/vnd.openxmlformats-officedocument.wordprocessingml.template"; 386 case "mgp": return "application/vnd.osgeo.mapguide.package"; 387 case "dp": return "application/vnd.osgi.dp"; 388 case "pdb","pqa","oprc": return "application/vnd.palm"; 389 case "paw": return "application/vnd.pawaafile"; 390 case "str": return "application/vnd.pg.format"; 391 case "ei6": return "application/vnd.pg.osasli"; 392 case "efif": return "application/vnd.picsel"; 393 case "wg": return "application/vnd.pmi.widget"; 394 case "plf": return "application/vnd.pocketlearn"; 395 case "pbd": return "application/vnd.powerbuilder6"; 396 case "box": return "application/vnd.previewsystems.box"; 397 case "mgz": return "application/vnd.proteus.magazine"; 398 case "qps": return "application/vnd.publishare-delta-tree"; 399 case "ptid": return "application/vnd.pvi.ptid1"; 400 case "qxd","qxt","qwd","qwt","qxl","qxb": return "application/vnd.quark.quarkxpress"; 401 case "bed": return "application/vnd.realvnc.bed"; 402 case "mxl": return "application/vnd.recordare.musicxml"; 403 case "musicxml": return "application/vnd.recordare.musicxml+xml"; 404 case "cryptonote": return "application/vnd.rig.cryptonote"; 405 case "cod": return "application/vnd.rim.cod"; 406 case "rm": return "application/vnd.rn-realmedia"; 407 case "link66": return "application/vnd.route66.link66+xml"; 408 case "st": return "application/vnd.sailingtracker.track"; 409 case "see": return "application/vnd.seemail"; 410 case "sema": return "application/vnd.sema"; 411 case "semd": return "application/vnd.semd"; 412 case "semf": return "application/vnd.semf"; 413 case "ifm": return "application/vnd.shana.informed.formdata"; 414 case "itp": return "application/vnd.shana.informed.formtemplate"; 415 case "iif": return "application/vnd.shana.informed.interchange"; 416 case "ipk": return "application/vnd.shana.informed.package"; 417 case "twd","twds": return "application/vnd.simtech-mindmapper"; 418 case "mmf": return "application/vnd.smaf"; 419 case "teacher": return "application/vnd.smart.teacher"; 420 case "sdkm","sdkd": return "application/vnd.solent.sdkm+xml"; 421 case "dxp": return "application/vnd.spotfire.dxp"; 422 case "sfs": return "application/vnd.spotfire.sfs"; 423 case "sdc": return "application/vnd.stardivision.calc"; 424 case "sda": return "application/vnd.stardivision.draw"; 425 case "sdd": return "application/vnd.stardivision.impress"; 426 case "smf": return "application/vnd.stardivision.math"; 427 case "sdw","vor": return "application/vnd.stardivision.writer"; 428 case "sgl": return "application/vnd.stardivision.writer-global"; 429 case "smzip": return "application/vnd.stepmania.package"; 430 case "sm": return "application/vnd.stepmania.stepchart"; 431 case "sxc": return "application/vnd.sun.xml.calc"; 432 case "stc": return "application/vnd.sun.xml.calc.template"; 433 case "sxd": return "application/vnd.sun.xml.draw"; 434 case "std": return "application/vnd.sun.xml.draw.template"; 435 case "sxi": return "application/vnd.sun.xml.impress"; 436 case "sti": return "application/vnd.sun.xml.impress.template"; 437 case "sxm": return "application/vnd.sun.xml.math"; 438 case "sxw": return "application/vnd.sun.xml.writer"; 439 case "sxg": return "application/vnd.sun.xml.writer.global"; 440 case "stw": return "application/vnd.sun.xml.writer.template"; 441 case "sus","susp": return "application/vnd.sus-calendar"; 442 case "svd": return "application/vnd.svd"; 443 case "sis","sisx": return "application/vnd.symbian.install"; 444 case "xsm": return "application/vnd.syncml+xml"; 445 case "bdm": return "application/vnd.syncml.dm+wbxml"; 446 case "xdm": return "application/vnd.syncml.dm+xml"; 447 case "tao": return "application/vnd.tao.intent-module-archive"; 448 case "pcap","cap","dmp": return "application/vnd.tcpdump.pcap"; 449 case "tmo": return "application/vnd.tmobile-livetv"; 450 case "tpt": return "application/vnd.trid.tpt"; 451 case "mxs": return "application/vnd.triscape.mxs"; 452 case "tra": return "application/vnd.trueapp"; 453 case "ufd","ufdl": return "application/vnd.ufdl"; 454 case "utz": return "application/vnd.uiq.theme"; 455 case "umj": return "application/vnd.umajin"; 456 case "unityweb": return "application/vnd.unity"; 457 case "uoml": return "application/vnd.uoml+xml"; 458 case "vcx": return "application/vnd.vcx"; 459 case "vsd","vst","vss","vsw": return "application/vnd.visio"; 460 case "vis": return "application/vnd.visionary"; 461 case "vsf": return "application/vnd.vsf"; 462 case "wbxml": return "application/vnd.wap.wbxml"; 463 case "wmlc": return "application/vnd.wap.wmlc"; 464 case "wmlsc": return "application/vnd.wap.wmlscriptc"; 465 case "wtb": return "application/vnd.webturbo"; 466 case "nbp": return "application/vnd.wolfram.player"; 467 case "wpd": return "application/vnd.wordperfect"; 468 case "wqd": return "application/vnd.wqd"; 469 case "stf": return "application/vnd.wt.stf"; 470 case "xar": return "application/vnd.xara"; 471 case "xfdl": return "application/vnd.xfdl"; 472 case "hvd": return "application/vnd.yamaha.hv-dic"; 473 case "hvs": return "application/vnd.yamaha.hv-script"; 474 case "hvp": return "application/vnd.yamaha.hv-voice"; 475 case "osf": return "application/vnd.yamaha.openscoreformat"; 476 case "osfpvg": return "application/vnd.yamaha.openscoreformat.osfpvg+xml"; 477 case "saf": return "application/vnd.yamaha.smaf-audio"; 478 case "spf": return "application/vnd.yamaha.smaf-phrase"; 479 case "cmp": return "application/vnd.yellowriver-custom-menu"; 480 case "zir","zirz": return "application/vnd.zul"; 481 case "zaz": return "application/vnd.zzazz.deck+xml"; 482 case "vxml": return "application/voicexml+xml"; 483 case "wasm": return "application/wasm"; 484 case "wgt": return "application/widget"; 485 case "hlp": return "application/winhlp"; 486 case "wsdl": return "application/wsdl+xml"; 487 case "wspolicy": return "application/wspolicy+xml"; 488 case "7z": return "application/x-7z-compressed"; 489 case "abw": return "application/x-abiword"; 490 case "ace": return "application/x-ace-compressed"; 491 case "aab","x32","u32","vox": return "application/x-authorware-bin"; 492 case "aam": return "application/x-authorware-map"; 493 case "aas": return "application/x-authorware-seg"; 494 case "bcpio": return "application/x-bcpio"; 495 case "torrent": return "application/x-bittorrent"; 496 case "bz": return "application/x-bzip"; 497 case "bz2","boz": return "application/x-bzip2"; 498 case "vcd": return "application/x-cdlink"; 499 case "chat": return "application/x-chat"; 500 case "pgn": return "application/x-chess-pgn"; 501 case "cpio": return "application/x-cpio"; 502 case "csh": return "application/x-csh"; 503 case "deb","udeb": return "application/x-debian-package"; 504 case "dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa": return "application/x-director"; 505 case "wad": return "application/x-doom"; 506 case "ncx": return "application/x-dtbncx+xml"; 507 case "dtb": return "application/x-dtbook+xml"; 508 case "res": return "application/x-dtbresource+xml"; 509 case "dvi": return "application/x-dvi"; 510 case "bdf": return "application/x-font-bdf"; 511 case "gsf": return "application/x-font-ghostscript"; 512 case "psf": return "application/x-font-linux-psf"; 513 case "otf": return "application/x-font-otf"; 514 case "pcf": return "application/x-font-pcf"; 515 case "snf": return "application/x-font-snf"; 516 case "ttf","ttc": return "application/x-font-ttf"; 517 case "pfa","pfb","pfm","afm": return "application/x-font-type1"; 518 case "woff": return "application/x-font-woff"; 519 case "spl": return "application/x-futuresplash"; 520 case "gnumeric": return "application/x-gnumeric"; 521 case "gtar": return "application/x-gtar"; 522 case "hdf": return "application/x-hdf"; 523 case "jnlp": return "application/x-java-jnlp-file"; 524 case "latex": return "application/x-latex"; 525 case "prc","mobi": return "application/x-mobipocket-ebook"; 526 case "application": return "application/x-ms-application"; 527 case "wmd": return "application/x-ms-wmd"; 528 case "wmz": return "application/x-ms-wmz"; 529 case "xbap": return "application/x-ms-xbap"; 530 case "mdb": return "application/x-msaccess"; 531 case "obd": return "application/x-msbinder"; 532 case "crd": return "application/x-mscardfile"; 533 case "clp": return "application/x-msclip"; 534 case "exe","dll","com","bat","msi": return "application/x-msdownload"; 535 case "mvb","m13","m14": return "application/x-msmediaview"; 536 case "wmf": return "application/x-msmetafile"; 537 case "mny": return "application/x-msmoney"; 538 case "pub": return "application/x-mspublisher"; 539 case "scd": return "application/x-msschedule"; 540 case "trm": return "application/x-msterminal"; 541 case "wri": return "application/x-mswrite"; 542 case "nc","cdf": return "application/x-netcdf"; 543 case "p12","pfx": return "application/x-pkcs12"; 544 case "p7b","spc": return "application/x-pkcs7-certificates"; 545 case "p7r": return "application/x-pkcs7-certreqresp"; 546 case "rar": return "application/x-rar-compressed"; 547 case "sh": return "application/x-sh"; 548 case "shar": return "application/x-shar"; 549 case "swf": return "application/x-shockwave-flash"; 550 case "xap": return "application/x-silverlight-app"; 551 case "sit": return "application/x-stuffit"; 552 case "sitx": return "application/x-stuffitx"; 553 case "sv4cpio": return "application/x-sv4cpio"; 554 case "sv4crc": return "application/x-sv4crc"; 555 case "tar": return "application/x-tar"; 556 case "tcl": return "application/x-tcl"; 557 case "tex": return "application/x-tex"; 558 case "tfm": return "application/x-tex-tfm"; 559 case "texinfo","texi": return "application/x-texinfo"; 560 case "ustar": return "application/x-ustar"; 561 case "src": return "application/x-wais-source"; 562 case "der","crt": return "application/x-x509-ca-cert"; 563 case "fig": return "application/x-xfig"; 564 case "xpi": return "application/x-xpinstall"; 565 case "xdf": return "application/xcap-diff+xml"; 566 case "xenc": return "application/xenc+xml"; 567 case "xhtml","xht": return "application/xhtml+xml"; 568 case "xml","xsl": return "application/xml"; 569 case "dtd": return "application/xml-dtd"; 570 case "xop": return "application/xop+xml"; 571 case "xslt": return "application/xslt+xml"; 572 case "xspf": return "application/xspf+xml"; 573 case "mxml","xhvml","xvml","xvm": return "application/xv+xml"; 574 case "yang": return "application/yang"; 575 case "yin": return "application/yin+xml"; 576 case "zip": return "application/zip"; 577 case "adp": return "audio/adpcm"; 578 case "au","snd": return "audio/basic"; 579 case "mid","midi","kar","rmi": return "audio/midi"; 580 case "mp4a": return "audio/mp4"; 581 case "mpga","mp2","mp2a","mp3","m2a","m3a": return "audio/mpeg"; 582 case "oga","ogg","spx": return "audio/ogg"; 583 case "uva","uvva": return "audio/vnd.dece.audio"; 584 case "eol": return "audio/vnd.digital-winds"; 585 case "dra": return "audio/vnd.dra"; 586 case "dts": return "audio/vnd.dts"; 587 case "dtshd": return "audio/vnd.dts.hd"; 588 case "lvp": return "audio/vnd.lucent.voice"; 589 case "pya": return "audio/vnd.ms-playready.media.pya"; 590 case "ecelp4800": return "audio/vnd.nuera.ecelp4800"; 591 case "ecelp7470": return "audio/vnd.nuera.ecelp7470"; 592 case "ecelp9600": return "audio/vnd.nuera.ecelp9600"; 593 case "rip": return "audio/vnd.rip"; 594 case "weba": return "audio/webm"; 595 case "aac": return "audio/x-aac"; 596 case "aif","aiff","aifc": return "audio/x-aiff"; 597 case "m3u": return "audio/x-mpegurl"; 598 case "wax": return "audio/x-ms-wax"; 599 case "wma": return "audio/x-ms-wma"; 600 case "ram","ra": return "audio/x-pn-realaudio"; 601 case "rmp": return "audio/x-pn-realaudio-plugin"; 602 case "wav": return "audio/x-wav"; 603 case "cdx": return "chemical/x-cdx"; 604 case "cif": return "chemical/x-cif"; 605 case "cmdf": return "chemical/x-cmdf"; 606 case "cml": return "chemical/x-cml"; 607 case "csml": return "chemical/x-csml"; 608 case "xyz": return "chemical/x-xyz"; 609 case "bmp": return "image/bmp"; 610 case "cgm": return "image/cgm"; 611 case "g3": return "image/g3fax"; 612 case "gif": return "image/gif"; 613 case "ief": return "image/ief"; 614 case "jpeg","jpg","jpe": return "image/jpeg"; 615 case "ktx": return "image/ktx"; 616 case "png": return "image/png"; 617 case "btif": return "image/prs.btif"; 618 case "svg","svgz": return "image/svg+xml"; 619 case "tiff","tif": return "image/tiff"; 620 case "psd": return "image/vnd.adobe.photoshop"; 621 case "uvi","uvvi","uvg","uvvg": return "image/vnd.dece.graphic"; 622 case "sub": return "image/vnd.dvb.subtitle"; 623 case "djvu","djv": return "image/vnd.djvu"; 624 case "dwg": return "image/vnd.dwg"; 625 case "dxf": return "image/vnd.dxf"; 626 case "fbs": return "image/vnd.fastbidsheet"; 627 case "fpx": return "image/vnd.fpx"; 628 case "fst": return "image/vnd.fst"; 629 case "mmr": return "image/vnd.fujixerox.edmics-mmr"; 630 case "rlc": return "image/vnd.fujixerox.edmics-rlc"; 631 case "mdi": return "image/vnd.ms-modi"; 632 case "npx": return "image/vnd.net-fpx"; 633 case "wbmp": return "image/vnd.wap.wbmp"; 634 case "xif": return "image/vnd.xiff"; 635 case "webp": return "image/webp"; 636 case "ras": return "image/x-cmu-raster"; 637 case "cmx": return "image/x-cmx"; 638 case "fh","fhc","fh4","fh5","fh7": return "image/x-freehand"; 639 case "ico": return "image/x-icon"; 640 case "pcx": return "image/x-pcx"; 641 case "pic","pct": return "image/x-pict"; 642 case "pnm": return "image/x-portable-anymap"; 643 case "pbm": return "image/x-portable-bitmap"; 644 case "pgm": return "image/x-portable-graymap"; 645 case "ppm": return "image/x-portable-pixmap"; 646 case "rgb": return "image/x-rgb"; 647 case "xbm": return "image/x-xbitmap"; 648 case "xpm": return "image/x-xpixmap"; 649 case "xwd": return "image/x-xwindowdump"; 650 case "eml","mime": return "message/rfc822"; 651 case "igs","iges": return "model/iges"; 652 case "msh","mesh","silo": return "model/mesh"; 653 case "dae": return "model/vnd.collada+xml"; 654 case "dwf": return "model/vnd.dwf"; 655 case "gdl": return "model/vnd.gdl"; 656 case "gtw": return "model/vnd.gtw"; 657 case "mts": return "model/vnd.mts"; 658 case "vtu": return "model/vnd.vtu"; 659 case "wrl","vrml": return "model/vrml"; 660 case "ics","ifb": return "text/calendar"; 661 case "css": return "text/css"; 662 case "csv": return "text/csv"; 663 case "html","htm": return "text/html"; 664 case "n3": return "text/n3"; 665 case "txt","text","conf","def","list","log","in": return "text/plain"; 666 case "dsc": return "text/prs.lines.tag"; 667 case "rtx": return "text/richtext"; 668 case "sgml","sgm": return "text/sgml"; 669 case "tsv": return "text/tab-separated-values"; 670 case "t","tr","roff","man","me","ms": return "text/troff"; 671 case "ttl": return "text/turtle"; 672 case "uri","uris","urls": return "text/uri-list"; 673 case "vcard": return "text/vcard"; 674 case "curl": return "text/vnd.curl"; 675 case "dcurl": return "text/vnd.curl.dcurl"; 676 case "scurl": return "text/vnd.curl.scurl"; 677 case "mcurl": return "text/vnd.curl.mcurl"; 678 case "fly": return "text/vnd.fly"; 679 case "flx": return "text/vnd.fmi.flexstor"; 680 case "gv": return "text/vnd.graphviz"; 681 case "3dml": return "text/vnd.in3d.3dml"; 682 case "spot": return "text/vnd.in3d.spot"; 683 case "jad": return "text/vnd.sun.j2me.app-descriptor"; 684 case "wml": return "text/vnd.wap.wml"; 685 case "wmls": return "text/vnd.wap.wmlscript"; 686 case "s","asm": return "text/x-asm"; 687 case "c","cc","cxx","cpp","h","hh","dic": return "text/x-c"; 688 case "f","for","f77","f90": return "text/x-fortran"; 689 case "p","pas": return "text/x-pascal"; 690 case "java": return "text/x-java-source"; 691 case "etx": return "text/x-setext"; 692 case "uu": return "text/x-uuencode"; 693 case "vcs": return "text/x-vcalendar"; 694 case "vcf": return "text/x-vcard"; 695 case "3gp": return "video/3gpp"; 696 case "3g2": return "video/3gpp2"; 697 case "h261": return "video/h261"; 698 case "h263": return "video/h263"; 699 case "h264": return "video/h264"; 700 case "jpgv": return "video/jpeg"; 701 case "jpm","jpgm": return "video/jpm"; 702 case "mj2","mjp2": return "video/mj2"; 703 case "mp4","mp4v","mpg4": return "video/mp4"; 704 case "mpeg","mpg","mpe","m1v","m2v": return "video/mpeg"; 705 case "ogv": return "video/ogg"; 706 case "qt","mov": return "video/quicktime"; 707 case "uvh","uvvh": return "video/vnd.dece.hd"; 708 case "uvm","uvvm": return "video/vnd.dece.mobile"; 709 case "uvp","uvvp": return "video/vnd.dece.pd"; 710 case "uvs","uvvs": return "video/vnd.dece.sd"; 711 case "uvv","uvvv": return "video/vnd.dece.video"; 712 case "dvb": return "video/vnd.dvb.file"; 713 case "fvt": return "video/vnd.fvt"; 714 case "mxu","m4u": return "video/vnd.mpegurl"; 715 case "pyv": return "video/vnd.ms-playready.media.pyv"; 716 case "uvu","uvvu": return "video/vnd.uvvu.mp4"; 717 case "viv": return "video/vnd.vivo"; 718 case "webm": return "video/webm"; 719 case "f4v": return "video/x-f4v"; 720 case "fli": return "video/x-fli"; 721 case "flv": return "video/x-flv"; 722 case "m4v": return "video/x-m4v"; 723 case "asf","asx": return "video/x-ms-asf"; 724 case "wm": return "video/x-ms-wm"; 725 case "wmv": return "video/x-ms-wmv"; 726 case "wmx": return "video/x-ms-wmx"; 727 case "wvx": return "video/x-ms-wvx"; 728 case "avi": return "video/x-msvideo"; 729 case "movie": return "video/x-sgi-movie"; 730 case "ice": return "x-conference/x-cooltalk"; 731 732 case "gz": return "application/gzip"; 733 case "tgz": return "application/gzip"; 734 } 735 } 736 737 /** 738 Returns true for a selected but incomplete list of mime-types that are describing a compressed 739 format. 740 741 This function is useful for avoiding redundant compression. 742 */ 743 bool isCompressedFormat(string mimetype) 744 @safe nothrow pure @nogc 745 { 746 switch(mimetype){ 747 default: return false; 748 case "application/gzip", "application/x-compress", "application/png", "application/zip", 749 "audio/x-mpeg", "image/png", "image/jpeg", 750 "video/mpeg", "video/quicktime", "video/x-msvideo", 751 "application/font-woff", "application/x-font-woff", "font/woff": 752 return true; 753 } 754 }