diff options
author | Christoffer Sawicki <christoffer.sawicki@gmail.com> | 2008-07-05 02:13:17 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2008-07-06 14:18:30 +0200 |
commit | f3b542a5bb40f8399ff1438569192bf531b422e9 (patch) | |
tree | 219a9f194de3d024e6f276b2eff4cab0bc32dd10 | |
parent | a2157d005827de41aa67ec046c618feaf69196ee (diff) | |
download | rack-f3b542a5bb40f8399ff1438569192bf531b422e9.tar.gz |
deflater.rb - Move out the Zlib::Deflate constructor arguments to a constant
-rw-r--r-- | lib/rack/deflater.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/rack/deflater.rb b/lib/rack/deflater.rb index d4f4e137..047940ff 100644 --- a/lib/rack/deflater.rb +++ b/lib/rack/deflater.rb @@ -42,14 +42,17 @@ class Deflater return io.string end + DEFLATE_ARGS = [ + Zlib::DEFAULT_COMPRESSION, + # drop the zlib header which causes both Safari and IE to choke + -Zlib::MAX_WBITS, + Zlib::DEF_MEM_LEVEL, + Zlib::DEFAULT_STRATEGY + ] + # Loosely based on Mongrel's Deflate handler def self.deflate(body) - deflater = Zlib::Deflate.new( - Zlib::DEFAULT_COMPRESSION, - # drop the zlib header which causes both Safari and IE to choke - -Zlib::MAX_WBITS, - Zlib::DEF_MEM_LEVEL, - Zlib::DEFAULT_STRATEGY) + deflater = Zlib::Deflate.new(*DEFLATE_ARGS) # TODO: Add streaming # TODO: Consider all part types |