about summary refs log tree commit
path: root/lib/metropolis/common.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-11-30 16:26:20 -0800
committerEric Wong <normalperson@yhbt.net>2010-11-30 16:26:20 -0800
commit27eb2d7ebd29239a5043a528c97c6dd218d03217 (patch)
tree7eb9ccc289cd78af10374c01fb80061f0abeeff3 /lib/metropolis/common.rb
parent03755186d6cb968d44d7eb04de3ed2d047180272 (diff)
downloadmetropolis-27eb2d7ebd29239a5043a528c97c6dd218d03217.tar.gz
support pass-through :encoding for deflate and gzip
These allow serving pre-compressed data off disk and
on-the-fly uncompressing for the few clients that do
not accept compressed responses.
Diffstat (limited to 'lib/metropolis/common.rb')
-rw-r--r--lib/metropolis/common.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/metropolis/common.rb b/lib/metropolis/common.rb
index 273a1b3..971accd 100644
--- a/lib/metropolis/common.rb
+++ b/lib/metropolis/common.rb
@@ -13,6 +13,15 @@ module Metropolis::Common
     if @readonly && @exclusive
       raise ArgumentError, ":readonly and :exclusive may not be used together"
     end
+    case @encoding = opts[:encoding]
+    when nil
+    when :deflate
+      extend(Metropolis::Deflate)
+    when :gzip
+      extend(Metropolis::Gzip)
+    else
+      raise ArgumentError, "unsupported encoding"
+    end
   end
 
   def r(code, body = nil)