about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/rainbows/response.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/rainbows/response.rb b/lib/rainbows/response.rb
index 705de62..b624ea2 100644
--- a/lib/rainbows/response.rb
+++ b/lib/rainbows/response.rb
@@ -124,7 +124,10 @@ module Rainbows::Response
         return
       a, b = $1.split(/-/)
 
-      headers = Rack::Utils::HeaderHash.new(headers)
+      # HeaderHash is quite expensive, and Rack::File currently
+      # uses a regular Ruby Hash with properly-cased headers the
+      # same way they're presented in rfc2616.
+      headers = Rack::Utils::HeaderHash.new(headers) unless Hash === headers
       clen = headers[Content_Length] or return
       size = clen.to_i