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/input_wrapper.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 lib/metropolis/input_wrapper.rb (limited to 'lib/metropolis/input_wrapper.rb') diff --git a/lib/metropolis/input_wrapper.rb b/lib/metropolis/input_wrapper.rb new file mode 100644 index 0000000..12a1bcc --- /dev/null +++ b/lib/metropolis/input_wrapper.rb @@ -0,0 +1,21 @@ +# -*- encoding: binary -*- + +class Metropolis::InputWrapper + def initialize(env) + @input = env["rack.input"] + env["rack.input"] = self + end + + def read(*args) + args.empty? and return read_all + ni + end + + def ni(*args) + raise NotImplementedError + end + + alias gets ni + alias each ni + alias rewind ni +end -- cgit v1.2.3-24-ge0c7