Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

add content type check to deflater #259

Merged
merged 2 commits into from

5 participants

@bartuer

try to make the checking as fast as possible, only filter most frequent types

test/spec_deflater.rb
((635 lines not shown))
+ 'video/vnd.vivo',
+ 'video/x-flv',
+ 'video/x-la-asf',
+ 'video/x-mng',
+ 'video/x-ms-asf',
+ 'video/x-ms-wm',
+ 'video/x-ms-wmv',
+ 'video/x-ms-wmx',
+ 'video/x-ms-wvx',
+ 'video/x-msvideo',
+ 'video/x-sgi-movie',
+ 'x-conference/x-cooltalk',
+ 'x-world/x-vrml',
+ ]
+
+ content_type_deflate_expection = {
@manveru Owner
manveru added a note

Looks like a typo, should that not be content_type_deflate_expectation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
test/spec_deflater.rb
@@ -166,4 +166,1300 @@ describe Rack::Deflater do
response[1].should.not.include "Content-Encoding"
response[2].join.should.equal("Hello World!")
end
+
+ should "check Content-Type is suitable for deflate" do
+ content_types = [
@manveru Owner
manveru added a note

Any Reason we cannot use Rack::Mime::MIME_TYPES here?

@bartuer
bartuer added a note
@bartuer
bartuer added a note

just count Rack::Mime::MIME_TYPES, it include 604 MIME types, but content_types include 641 types, I can not say it include all, hope to cover more test cases, this larger list just for test, if Rack::Mime::MIME_TYPES is enough, I will only test against it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@bartuer bartuer deflate type check against Rack::Mime::MIME_TYPES
- Rack::Mime::MIME_TYPES
  - now has 604 "file type" => "mime" maps
  - these 604 maps include 535 MIME types
  - all MIME types should deflate or not list in content_type_deflate_expectation
- fix typo
  content_type_deflate_expection -> content_type_deflate_expectation
1b3ed3f
@raggi
Owner

I'm not too sure I want to maintain this, in that I suspect it'll open up for a number of patches as people want to add to the list of checked mimes.

Is there a demonstrably significant benefit to this?

@spastorino
Owner

@bartuer can you point us to a demonstrably significant benefit to this?

@bartuer
@raggi raggi merged commit ec5634c into rack:master
@raggi
Owner

This code is being used more and more since Heroku shut down their external file serving, so it's probably worth it for those folks.

Thanks!

@raggi raggi referenced this pull request from a commit
@raggi raggi Revert "Merge pull request #259 from bartuer/master"
This reverts commit ec5634c, reversing
changes made to c23edf4.
c479354
@raggi
Owner

Er, correction, reverted due to failure, and very large (unreadable) failure message. Lets get this test written a more manageable way.

@bpinto

image/svg+xml should be compressed svg => svgz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 24, 2011
  1. @bartuer

    check deflater content type

    bartuer authored
  2. @bartuer

    deflate type check against Rack::Mime::MIME_TYPES

    bartuer authored
    - Rack::Mime::MIME_TYPES
      - now has 604 "file type" => "mime" maps
      - these 604 maps include 535 MIME types
      - all MIME types should deflate or not list in content_type_deflate_expectation
    - fix typo
      content_type_deflate_expection -> content_type_deflate_expectation
This page is out of date. Refresh to see the latest.
Showing with 565 additions and 0 deletions.
  1. +17 −0 lib/rack/deflater.rb
  2. +548 −0 test/spec_deflater.rb
View
17 lib/rack/deflater.rb
@@ -9,8 +9,25 @@ def initialize(app)
@app = app
end
+ def deflate_type?(mime)
+ return true if mime == nil
+ type, sub = mime.split('/')
+ return true if type == 'text'
+ return false if type == 'audio' || type == 'video' || type == 'image'
+ if type == 'application'
+ sub = sub.split(';')[0]
+ return true if ['x-javascript', 'json', 'ecmascript', 'x-python-code'].include?(sub) || sub.include?('xml')
+ reject_type = ['mp4', 'octet-stream', 'ogg', 'pdf', 'rar', 'zip', 'postscript']
+ return false if reject_type.include?(sub) || sub[0..1] == 'x-' || ['vnd.', 'java'].include?(sub[0..3])
+ end
+ return true
+ end
+
def call(env)
status, headers, body = @app.call(env)
+
+ return [status, headers, body] unless deflate_type?(headers['Content-Type'])
+
headers = Utils::HeaderHash.new(headers)
# Skip compressing empty entity body responses and responses with
View
548 test/spec_deflater.rb
@@ -166,4 +166,552 @@ class << body; def each; yield("foo"); yield("bar"); end; end
response[1].should.not.include "Content-Encoding"
response[2].join.should.equal("Hello World!")
end
+
+ should "check Content-Type is suitable for deflate" do
+ # if Rack::Mime::MIME_TYPES changed, it would be tedious to check and update content_type_deflate_expectation
+ content_type_deflate_expectation = {
+ "application/vnd.yamaha.smaf-audio" => false,
+ "text/vnd.in3d.spot" => true,
+ "application/marc" => true,
+ "application/vnd.acucobol" => false,
+ "text/x-pascal" => true,
+ "application/vnd.hydrostatix.sof-data" => false,
+ "image/gif" => false,
+ "text/vnd.wap.wmlscript" => true,
+ "image/x-rgb" => false,
+ "application/oda" => true,
+ "application/vnd.shana.informed.interchange" => false,
+ "application/vnd.grafeq" => false,
+ "application/vnd.kde.karbon" => false,
+ "application/vnd.novadigm.edx" => false,
+ "application/x-mswrite" => false,
+ "application/x-chat" => false,
+ "image/vnd.ms-modi" => false,
+ "application/x-msmoney" => false,
+ "application/x-pkcs7-certreqresp" => false,
+ "application/vnd.oasis.opendocument.chart-template" => false,
+ "application/vnd.sus-calendar" => false,
+ "application/vnd.kinar" => false,
+ "chemical/x-pdb" => true,
+ "application/vnd.kenameaapp" => false,
+ "application/vnd.gmx" => false,
+ "application/srgs" => true,
+ "application/vnd.pocketlearn" => false,
+ "application/vnd.mseq" => false,
+ "application/vnd.trid.tpt" => false,
+ "application/vnd.previewsystems.box" => false,
+ "application/x-ms-wmz" => false,
+ "application/vnd.vsf" => false,
+ "video/x-flv" => false,
+ "application/vnd.mcd" => false,
+ "application/set-registration-initiation" => true,
+ "application/xml" => true,
+ "application/x-tex" => false,
+ "application/xop+xml" => true,
+ "application/vnd.ms-excel" => false,
+ "video/mp4" => false,
+ "application/vnd.ms-wpl" => false,
+ "application/vnd.kidspiration" => false,
+ "application/vnd.ms-ims" => false,
+ "application/x-shockwave-flash" => false,
+ "application/vnd.novadigm.ext" => false,
+ "application/reginfo+xml" => true,
+ "model/mesh" => true,
+ "image/x-cmx" => false,
+ "application/vnd.crick.clicker.palette" => false,
+ "video/x-sgi-movie" => false,
+ "application/x-msschedule" => false,
+ "application/resource-lists-diff+xml" => true,
+ "application/x-hdf" => false,
+ "application/vnd.cosmocaller" => false,
+ "application/vnd.fujitsu.oasys" => false,
+ "chemical/x-cdx" => true,
+ "application/vnd.solent.sdkm+xml" => true,
+ "image/x-portable-bitmap" => false,
+ "application/vnd.macports.portpkg" => false,
+ "application/x-debian-package" => false,
+ "application/vnd.ctc-posml" => false,
+ "text/yaml" => true,
+ "application/vnd.oasis.opendocument.text-template" => false,
+ "video/vnd.fvt" => false,
+ "audio/mpeg" => false,
+ "application/vnd.framemaker" => false,
+ "application/mp4" => false,
+ "application/andrew-inset" => true,
+ "application/voicexml+xml" => true,
+ "application/vnd.micrografx.igx" => false,
+ "application/x-redhat-package-manager" => false,
+ "video/x-ms-wmv" => false,
+ "application/vnd.lotus-approach" => false,
+ "text/uri-list" => true,
+ "application/vnd.mfmp" => false,
+ "application/vnd.oasis.opendocument.image" => false,
+ "application/vnd.pg.format" => false,
+ "application/vnd.kahootz" => false,
+ "video/x-ms-wmx" => false,
+ "application/vnd.svd" => false,
+ "application/vnd.llamagraphics.life-balance.exchange+xml" => true,
+ "application/vnd.amiga.ami" => false,
+ "application/vnd.ms-htmlhelp" => false,
+ "application/vnd.yamaha.hv-dic" => false,
+ "image/vnd.djvu" => false,
+ "application/vnd.ms-cab-compressed" => false,
+ "application/vnd.dna" => false,
+ "application/vnd.ms-lrm" => false,
+ "application/vnd.oasis.opendocument.spreadsheet-template" => false,
+ "image/x-pcx" => false,
+ "application/relax-ng-compact-syntax" => true,
+ "text/vnd.sun.j2me.app-descriptor" => true,
+ "application/atomsvc+xml" => true,
+ "application/x-tcl" => false,
+ "application/x-stuffitx" => false,
+ "application/vnd.irepository.package+xml" => true,
+ "application/vnd.hp-hpid" => false,
+ "audio/basic" => false,
+ "video/3gpp" => false,
+ "application/x-msmediaview" => false,
+ "application/vnd.recordare.musicxml" => true,
+ "application/vnd.ezpix-package" => false,
+ "application/x-msbinder" => false,
+ "application/winhlp" => true,
+ "text/x-fortran" => true,
+ "application/vnd.intu.qbo" => false,
+ "text/vnd.in3d.3dml" => true,
+ "application/pgp-signature" => true,
+ "application/vnd.proteus.magazine" => false,
+ "application/scvp-vp-request" => true,
+ "application/x-bzip" => false,
+ "application/vnd.ms-xpsdocument" => false,
+ "image/svg+xml" => false,
+ "image/bmp" => false,
+ "audio/x-ms-wax" => false,
+ "application/vnd.chemdraw+xml" => true,
+ "application/x-pkcs7-certificates" => false,
+ "application/x-chess-pgn" => false,
+ "application/vnd.jam" => false,
+ "application/x-bzip2" => false,
+ "application/vnd.enliven" => false,
+ "application/vnd.3gpp.pic-bw-large" => false,
+ "application/vnd.fsc.weblaunch" => false,
+ "application/vnd.spotfire.sfs" => false,
+ "application/vnd.3m.post-it-notes" => false,
+ "application/vnd.koan" => false,
+ "application/vnd.hp-pcl" => false,
+ "application/vnd.ibm.secure-container" => false,
+ "application/xml-dtd" => true,
+ "model/vnd.gdl" => true,
+ "application/vnd.groove-tool-message" => false,
+ "video/ogg" => false,
+ "application/vnd.lotus-freelance" => false,
+ "application/vnd.mobius.dis" => false,
+ "application/vnd.epson.salt" => false,
+ "application/vnd.dolby.mlp" => false,
+ "video/x-ms-wm" => false,
+ "application/pgp-encrypted" => true,
+ "application/vnd.ms-project" => false,
+ "video/h261" => false,
+ "application/vnd.ipunplugged.rcprofile" => false,
+ "application/x-x509-ca-cert" => false,
+ "x-conference/x-cooltalk" => true,
+ "image/g3fax" => false,
+ "audio/vnd.nuera.ecelp4800" => false,
+ "video/h263" => false,
+ "application/x-rar-compressed" => false,
+ "application/vnd.lotus-screencam" => false,
+ "application/vnd.dpgraph" => false,
+ "video/h264" => false,
+ "application/ogg" => false,
+ "application/x-bzip-compressed-tar" => false,
+ "image/vnd.fpx" => false,
+ "application/vnd.crick.clicker" => false,
+ "application/vnd.kodak-descriptor" => false,
+ "application/font-tdpfr" => true,
+ "application/vnd.groove-injector" => false,
+ "text/x-uuencode" => true,
+ "application/vnd.antix.game-component" => false,
+ "application/vnd.apple.installer+xml" => true,
+ "model/vnd.vtu" => true,
+ "application/vnd.blueice.multipass" => false,
+ "application/sbml+xml" => true,
+ "audio/x-mpegurl" => false,
+ "application/vnd.contact.cmsg" => false,
+ "image/pict" => false,
+ "application/x-cdlink" => false,
+ "application/vnd.kde.kspread" => false,
+ "application/vnd.tmobile-livetv" => false,
+ "application/resource-lists+xml" => true,
+ "application/vnd.kde.kontour" => false,
+ "application/vnd.hp-jlyt" => false,
+ "application/vnd.oma.dd2+xml" => true,
+ "application/vnd.jcp.javame.midlet-rms" => false,
+ "application/vnd.chipnuts.karaoke-mmd" => false,
+ "application/vnd.fujixerox.docuworks.binder" => false,
+ "application/vnd.oasis.opendocument.formula-template" => false,
+ "video/quicktime" => false,
+ "application/vnd.unity" => false,
+ "application/vnd.crick.clicker.wordbank" => false,
+ "application/pkix-crl" => true,
+ "application/vnd.anser-web-certificate-issue-initiation" => false,
+ "application/mac-compactpro" => true,
+ "audio/mp4a-latm" => false,
+ "application/lost+xml" => true,
+ "application/vnd.clonk.c4group" => false,
+ "chemical/x-xyz" => true,
+ "application/scvp-cv-response" => true,
+ "video/webm" => false,
+ "application/vnd.nokia.n-gage.data" => false,
+ "application/vnd.openofficeorg.extension" => false,
+ "application/vnd.fujixerox.ddd" => false,
+ "application/vnd.oasis.opendocument.text" => false,
+ "video/vnd.ms-playready.media.pyv" => false,
+ "application/x-stuffit" => false,
+ "application/json" => true,
+ "audio/vnd.digital-winds" => false,
+ "image/png" => false,
+ "application/x-mspublisher" => false,
+ "application/vnd.yamaha.hv-script" => false,
+ "application/vnd.frogans.ltf" => false,
+ "application/vnd.yamaha.hv-voice" => false,
+ "application/java-archive" => false,
+ "application/vnd.tao.intent-module-archive" => false,
+ "application/x-ustar" => false,
+ "application/vnd.ibm.rights-management" => false,
+ "application/vnd.oasis.opendocument.text-web" => false,
+ "application/x-tar" => false,
+ "application/vnd.curl" => false,
+ "text/richtext" => true,
+ "application/vnd.immervision-ivp" => false,
+ "application/vnd.bmi" => false,
+ "application/x-wais-source" => false,
+ "video/jpm" => false,
+ "image/x-portable-anymap" => false,
+ "text/x-diff" => true,
+ "application/patch-ops-error+xml" => true,
+ "application/vnd.hp-hpgl" => false,
+ "application/ecmascript" => true,
+ "application/set-payment-initiation" => true,
+ "application/vnd.acucorp" => false,
+ "application/vnd.mobius.txf" => false,
+ "application/vnd.3gpp.pic-bw-small" => false,
+ "application/vnd.oasis.opendocument.graphics" => false,
+ "application/vnd.nokia.n-gage.symbian.install" => false,
+ "application/vnd.immervision-ivu" => false,
+ "application/vnd.pvi.ptid1" => false,
+ "application/vnd.ms-fontobject" => false,
+ "application/rsd+xml" => true,
+ "application/vnd.picsel" => false,
+ "text/x-vcard" => true,
+ "application/vnd.palm" => false,
+ "image/cgm" => false,
+ "application/vnd.intercon.formnet" => false,
+ "application/x-java-jnlp-file" => false,
+ "application/vnd.ufdl" => false,
+ "application/vnd.wap.wmlscriptc" => false,
+ "application/vnd.lotus-organizer" => false,
+ "image/prs.btif" => false,
+ "application/smil+xml" => true,
+ "image/vnd.fst" => false,
+ "application/vnd.triscape.mxs" => false,
+ "application/mediaservercontrol+xml" => true,
+ "audio/x-pn-realaudio-plugin" => false,
+ "application/pkcs10" => true,
+ "application/pkcs7-signature" => true,
+ "image/tiff" => false,
+ "application/vnd.is-xpr" => false,
+ "image/vnd.adobe.photoshop" => false,
+ "application/vnd.ecowin.chart" => false,
+ "application/vnd.eszigno3+xml" => true,
+ "text/x-script.perl" => true,
+ "application/postscript" => false,
+ "model/vrml" => true,
+ "application/x-gtar" => false,
+ "application/vnd.ms-powerpoint" => false,
+ "application/x-netcdf" => false,
+ "application/vnd.mif" => false,
+ "application/vnd.oasis.opendocument.chart" => false,
+ "application/davmount+xml" => true,
+ "application/vnd.jisp" => false,
+ "application/vnd.hbci" => false,
+ "application/vnd.google-earth.kml+xml" => true,
+ "application/ccxml+xml" => true,
+ "application/vnd.hzn-3d-crossword" => false,
+ "application/vnd.groove-account" => false,
+ "image/x-quicktime" => false,
+ "application/xspf+xml" => true,
+ "application/vnd.groove-vcard" => false,
+ "image/jpeg" => false,
+ "application/vnd.commonspace" => false,
+ "application/vnd.dreamfactory" => false,
+ "application/vnd.flographit" => false,
+ "application/vnd.epson.msf" => false,
+ "application/vnd.genomatix.tuxedo" => false,
+ "application/pkixcmp" => true,
+ "application/vnd.ezpix-album" => false,
+ "image/jp2" => false,
+ "text/tab-separated-values" => true,
+ "audio/vnd.nuera.ecelp7470" => false,
+ "application/vnd.yellowriver-custom-menu" => false,
+ "application/vnd.fluxtime.clip" => false,
+ "application/atom+xml" => true,
+ "application/vnd.pg.osasli" => false,
+ "application/vnd.smaf" => false,
+ "application/vnd.mobius.msl" => false,
+ "application/scvp-vp-response" => true,
+ "image/vnd.fastbidsheet" => false,
+ "application/vnd.oasis.opendocument.presentation" => false,
+ "application/vnd.fdf" => false,
+ "application/vnd.nokia.radio-presets" => false,
+ "audio/vnd.ms-playready.media.pya" => false,
+ "image/x-macpaint" => false,
+ "application/vnd.kde.kpresenter" => false,
+ "video/x-msvideo" => false,
+ "application/sparql-query" => true,
+ "image/vnd.dwg" => false,
+ "application/vnd.wap.wbxml" => true,
+ "application/vnd.igloader" => false,
+ "application/vnd.accpac.simply.aso" => false,
+ "application/x-sv4crc" => false,
+ "application/x-dvi" => false,
+ "application/vnd.arastra.swi" => false,
+ "application/vnd.noblenet-sealer" => false,
+ "application/vnd.publishare-delta-tree" => false,
+ "application/vnd.zzazz.deck+xml" => true,
+ "text/troff" => true,
+ "application/vnd.3gpp2.tcap" => false,
+ "application/vnd.osgi.dp" => false,
+ "application/pkcs7-mime" => true,
+ "audio/vnd.nuera.ecelp9600" => false,
+ "application/rss+xml" => true,
+ "application/vnd.webturbo" => false,
+ "audio/x-wav" => false,
+ "application/xhtml+xml" => true,
+ "application/mac-binhex40" => true,
+ "application/pics-rules" => true,
+ "application/vnd.simtech-mindmapper" => false,
+ "audio/x-aiff" => false,
+ "application/vnd.adobe.xdp+xml" => true,
+ "application/vnd.hp-pclxl" => false,
+ "audio/x-pn-realaudio" => false,
+ "application/vnd.xfdl" => false,
+ "video/mj2" => false,
+ "application/vnd.shana.informed.formtemplate" => false,
+ "application/ssml+xml" => true,
+ "chemical/x-cml" => true,
+ "application/vnd.kde.kword" => false,
+ "text/x-setext" => true,
+ "application/rtf" => true,
+ "application/vnd.fujitsu.oasys2" => false,
+ "text/css" => true,
+ "image/vnd.fujixerox.edmics-rlc" => false,
+ "application/vnd.ms-artgalry" => false,
+ "application/wspolicy+xml" => true,
+ "application/x-msdownload" => false,
+ "text/calendar" => true,
+ "application/vnd.umajin" => false,
+ "application/vnd.fujitsu.oasys3" => false,
+ "image/vnd.fujixerox.edmics-mmr" => false,
+ "application/hyperstudio" => true,
+ "application/vnd.nokia.radio-preset" => false,
+ "application/vnd.groove-help" => false,
+ "text/prs.lines.tag" => true,
+ "application/vnd.anser-web-funds-transfer-initiation" => false,
+ "application/mbox" => true,
+ "text/csv" => true,
+ "text/plain" => true,
+ "video/x-mng" => false,
+ "application/vnd.noblenet-directory" => false,
+ "application/mathematica" => true,
+ "application/x-csh" => false,
+ "application/vnd.ibm.minipay" => false,
+ "application/atomcat+xml" => true,
+ "application/vnd.mobius.mbk" => false,
+ "audio/vnd.lucent.voice" => false,
+ "application/vnd.syncml+xml" => true,
+ "application/vnd.medcalcdata" => false,
+ "application/vnd.oasis.opendocument.formula" => false,
+ "application/vnd.kde.kivio" => false,
+ "text/x-component" => true,
+ "application/vnd.xara" => false,
+ "image/x-portable-graymap" => false,
+ "application/xslt+xml" => true,
+ "application/vnd.seemail" => false,
+ "image/x-pict" => false,
+ "application/x-pkcs12" => false,
+ "application/vnd.criticaltools.wbs+xml" => true,
+ "application/vnd.americandynamics.acc" => false,
+ "application/x-msclip" => false,
+ "application/vnd.neurolanguage.nlu" => false,
+ "application/vnd.joost.joda-archive" => false,
+ "application/vnd.quark.quarkxpress" => false,
+ "application/vnd.3gpp.pic-bw-var" => false,
+ "application/pkix-pkipath" => true,
+ "image/vnd.wap.wbmp" => false,
+ "text/x-vcalendar" => true,
+ "application/vnd.cups-ppd" => false,
+ "text/cache-manifest" => true,
+ "application/vnd.frogans.fnc" => false,
+ "video/jpeg" => false,
+ "text/vnd.wap.wml" => true,
+ "application/vnd.fuzzysheet" => false,
+ "application/vnd.route66.link66+xml" => true,
+ "audio/vnd.dts" => false,
+ "text/x-java-source" => true,
+ "application/vnd.vcx" => false,
+ "application/vnd.visionary" => false,
+ "application/sparql-results+xml" => true,
+ "application/mxf" => true,
+ "application/srgs+xml" => true,
+ "text/x-script.ruby" => true,
+ "text/vnd.graphviz" => true,
+ "application/vnd.groove-tool-template" => false,
+ "application/vnd.kde.kchart" => false,
+ "application/vnd.sema" => false,
+ "application/vnd.ms-works" => false,
+ "application/vnd.fujitsu.oasysgp" => false,
+ "application/vnd.llamagraphics.life-balance.desktop" => false,
+ "application/vnd.olpc-sugar" => false,
+ "application/vnd.crick.clicker.keyboard" => false,
+ "application/vnd.epson.ssf" => false,
+ "image/x-cmu-raster" => false,
+ "text/vnd.fmi.flexstor" => true,
+ "application/pdf" => false,
+ "model/vnd.dwf" => true,
+ "application/vnd.mobius.plc" => false,
+ "message/rfc822" => true,
+ "application/prs.cww" => true,
+ "chemical/x-csml" => true,
+ "video/x-dv" => false,
+ "application/vnd.semd" => false,
+ "application/vnd.muvee.style" => false,
+ "application/vnd.wordperfect" => false,
+ "application/shf+xml" => true,
+ "application/vnd.accpac.simply.imp" => false,
+ "application/vnd.groove-identity-message" => false,
+ "video/x-ms-wvx" => false,
+ "application/vnd.semf" => false,
+ "application/octet-stream" => false,
+ "application/vnd.powerbuilder6" => false,
+ "text/sgml" => true,
+ "image/x-xpixmap" => false,
+ "model/vnd.gtw" => true,
+ "audio/vnd.dts.hd" => false,
+ "image/vnd.xiff" => false,
+ "application/vnd.epson.quickanime" => false,
+ "application/vnd.claymore" => false,
+ "text/x-script.python" => true,
+ "application/x-futuresplash" => false,
+ "application/pls+xml" => true,
+ "application/pkix-cert" => true,
+ "application/vnd.wap.wmlc" => false,
+ "audio/midi" => false,
+ "application/vnd.oasis.opendocument.graphics-template" => false,
+ "text/vnd.fly" => true,
+ "application/x-bcpio" => false,
+ "image/ief" => false,
+ "text/x-script.perl-module" => true,
+ "application/vnd.uiq.theme" => false,
+ "application/vnd.shana.informed.formdata" => false,
+ "application/vnd.data-vision.rdz" => false,
+ "application/vnd.oasis.opendocument.spreadsheet" => false,
+ "application/xenc+xml" => true,
+ "application/wsdl+xml" => true,
+ "application/vnd.lotus-wordpro" => false,
+ "application/vnd.fujixerox.docuworks" => false,
+ "audio/mp4" => false,
+ "application/vnd.ibm.modcap" => false,
+ "application/vnd.google-earth.kmz" => false,
+ "application/vnd.lotus-notes" => false,
+ "application/vnd.denovo.fcselayout-link" => false,
+ "application/vnd.handheld-entertainment+xml" => true,
+ "application/vnd.syncml.dm+wbxml" => true,
+ "application/x-msmetafile" => false,
+ "application/vnd.mobius.mqy" => false,
+ "application/vnd.adobe.xfdf" => false,
+ "video/vnd.vivo" => false,
+ "application/vnd.rn-realmedia" => false,
+ "chemical/x-cmdf" => true,
+ "application/x-cpio" => false,
+ "application/x-mscardfile" => false,
+ "application/vnd.syncml.dm+xml" => true,
+ "application/vnd.wt.stf" => false,
+ "model/iges" => true,
+ "application/vnd.crick.clicker.template" => false,
+ "text/x-asm" => true,
+ "application/vnd.intu.qfx" => false,
+ "image/vnd.net-fpx" => false,
+ "application/x-director" => false,
+ "audio/x-ms-wma" => false,
+ "application/x-msaccess" => false,
+ "video/3gpp2" => false,
+ "text/html" => true,
+ "application/x-ms-wmd" => false,
+ "image/x-xwindowdump" => false,
+ "application/vnd.yamaha.smaf-phrase" => false,
+ "application/javascript" => false,
+ "application/vnd.mophun.certificate" => false,
+ "application/zip" => false,
+ "application/vnd.fujitsu.oasysprs" => false,
+ "application/vnd.musician" => false,
+ "application/x-shar" => false,
+ "application/vnd.mobius.daf" => false,
+ "image/x-xbitmap" => false,
+ "application/vnd.cinderella" => false,
+ "application/rdf+xml" => true,
+ "application/vnd.businessobjects" => false,
+ "image/vnd.microsoft.icon" => false,
+ "application/x-ace-compressed" => false,
+ "application/vnd.hp-hps" => false,
+ "application/vnd.epson.esf" => false,
+ "application/x-gzip" => false,
+ "application/vnd.mfer" => false,
+ "application/x-latex" => false,
+ "application/x-sv4cpio" => false,
+ "application/vnd.spotfire.dxp" => false,
+ "application/x-texinfo" => false,
+ "application/vnd.wqd" => false,
+ "application/vnd.mediastation.cdkey" => false,
+ "application/vnd.novadigm.edm" => false,
+ "application/vnd.kde.kformula" => false,
+ "application/vnd.lotus-1-2-3" => false,
+ "application/scvp-cv-request" => true,
+ "application/vnd.noblenet-web" => false,
+ "application/vnd.hhe.lesson-player" => false,
+ "video/x-fli" => false,
+ "application/vnd.shana.informed.package" => false,
+ "application/sdp" => true,
+ "application/vnd.mophun.application" => false,
+ "application/vnd.oasis.opendocument.image-template" => false,
+ "application/x-msterminal" => false,
+ "text/x-c" => true,
+ "chemical/x-cif" => true,
+ "application/vnd.visio" => false,
+ "application/msword" => true,
+ "application/x-sh" => false,
+ "image/x-portable-pixmap" => false,
+ "application/vnd.uoml+xml" => true,
+ "model/vnd.mts" => true,
+ "video/x-ms-asf" => false,
+ "video/vnd.mpegurl" => false,
+ "image/vnd.dxf" => false,
+ "application/xv+xml" => true,
+ "application/vnd.trueapp" => false,
+ "video/mpeg" => false,
+ "application/vnd.micrografx.flo" => false,
+ "application/x-bittorrent" => false,
+ "application/vnd.oasis.opendocument.text-master" => false,
+ "application/mathml+xml" => true,
+ "application/vnd.audiograph" => false,
+ "audio/ogg" => false,
+ "application/rls-services+xml" => true,
+ "application/vnd.iccprofile" => false,
+ "application/vnd.mozilla.xul+xml" => true
+ }
+ content_type_check_result = {}
+ app = lambda { |env| [status, {}, body] }
+ deflater = Rack::Deflater.new(app)
+ Rack::Mime::MIME_TYPES.values.map { |mime|
+ content_type_check_result[mime] = deflater.deflate_type?(mime)
+ }
+ content_type_check_result.should.equal(content_type_deflate_expectation)
+ end
end
Something went wrong with that request. Please try again.