From e8ae2e483e75ad163212cc8d3a7107eb2a014a9c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 5 Jan 2011 10:56:50 -0800 Subject: response: allow normal Hash for crafting Range 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. --- lib/rainbows/response.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/rainbows/response.rb') 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 -- cgit v1.2.3-24-ge0c7