From b895d3d0393a647d3602783bc53bf68e223e51c9 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 6 Jun 2010 05:17:14 +0000 Subject: pass-through body.to_path when wrapping the body Certain configurations of Rainbows! (and Zbatery) are able to use the return value of body.to_path to serve static files more efficiently. This also allows middleware like Rack::Contrib::Sendfile to work properly higher up the stack, too. --- lib/clogger.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/clogger.rb') diff --git a/lib/clogger.rb b/lib/clogger.rb index ba047f5..a827632 100644 --- a/lib/clogger.rb +++ b/lib/clogger.rb @@ -36,6 +36,15 @@ class Clogger :request_uri => 7 } + # proxy class to avoid clobbering the +to_path+ optimization when + # using static files + class ToPath < Struct.new(:clogger) + def each(&block); clogger.each(&block); end + def close; clogger.close; end + + # to_path is defined in Clogger::Pure or the C extension + end + private CGI_ENV = Regexp.new('\A\$(' << -- cgit v1.2.3-24-ge0c7