diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-12-10 21:34:17 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-12-10 21:34:17 -0600 |
commit | 8f836f406ca10274c6465e17c2b5646257a8412b (patch) | |
tree | e7c4cacda1c39312871d9ca9479442b0cdc093ac | |
parent | cdf13618445fa7065c07d62b115907856d6d1095 (diff) | |
download | rack-8f836f406ca10274c6465e17c2b5646257a8412b.tar.gz |
avoid HeaderHash#to_hash in middlewares
Since HeaderHash objects are valid header responses, avoid converting the headers to Hash objects only to have it reconverted back to HeaderHash in the next middleware. Signed-off-by: Joshua Peek <josh@joshpeek.com>
-rw-r--r-- | lib/rack/chunked.rb | 4 | ||||
-rw-r--r-- | lib/rack/content_type.rb | 2 | ||||
-rw-r--r-- | lib/rack/response.rb | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/lib/rack/chunked.rb b/lib/rack/chunked.rb index 280d89dd..dddf9694 100644 --- a/lib/rack/chunked.rb +++ b/lib/rack/chunked.rb @@ -19,7 +19,7 @@ module Rack STATUS_WITH_NO_ENTITY_BODY.include?(status) || headers['Content-Length'] || headers['Transfer-Encoding'] - [status, headers.to_hash, body] + [status, headers, body] else dup.chunk(status, headers, body) end @@ -29,7 +29,7 @@ module Rack @body = body headers.delete('Content-Length') headers['Transfer-Encoding'] = 'chunked' - [status, headers.to_hash, self] + [status, headers, self] end def each diff --git a/lib/rack/content_type.rb b/lib/rack/content_type.rb index 0c1e1ca3..874c28cd 100644 --- a/lib/rack/content_type.rb +++ b/lib/rack/content_type.rb @@ -17,7 +17,7 @@ module Rack status, headers, body = @app.call(env) headers = Utils::HeaderHash.new(headers) headers['Content-Type'] ||= @content_type - [status, headers.to_hash, body] + [status, headers, body] end end end diff --git a/lib/rack/response.rb b/lib/rack/response.rb index 92c8c4a6..a7f9bf2b 100644 --- a/lib/rack/response.rb +++ b/lib/rack/response.rb @@ -71,9 +71,9 @@ module Rack if [204, 304].include?(status.to_i) header.delete "Content-Type" - [status.to_i, header.to_hash, []] + [status.to_i, header, []] else - [status.to_i, header.to_hash, self] + [status.to_i, header, self] end end alias to_a finish # For *response |