about summary refs log tree commit homepage
path: root/lib/clogger.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-06-06 05:17:14 +0000
committerEric Wong <normalperson@yhbt.net>2010-06-06 06:26:45 +0000
commitb895d3d0393a647d3602783bc53bf68e223e51c9 (patch)
treedb7a7ed6d0f3200f27617a79aacd402d809eb722 /lib/clogger.rb
parentbc1d1df38d7803ce9fdae05fc5129051eeed89e0 (diff)
downloadclogger-b895d3d0393a647d3602783bc53bf68e223e51c9.tar.gz
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.
Diffstat (limited to 'lib/clogger.rb')
-rw-r--r--lib/clogger.rb9
1 files changed, 9 insertions, 0 deletions
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\$(' <<