From 27eb2d7ebd29239a5043a528c97c6dd218d03217 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 30 Nov 2010 16:26:20 -0800 Subject: 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. --- lib/metropolis/common.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/metropolis/common.rb') 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) -- cgit v1.2.3-24-ge0c7