make sure things inserted into the body are actually strings

This commit is contained in:
John Bintz 2012-09-18 17:22:19 -04:00
parent 8c83b90015
commit e998fab430

View File

@ -52,17 +52,12 @@ module Rack
deliver_file(target) deliver_file(target)
else else
status, headers, body = @app.call(env) status, headers, body = @app.call(env)
new_body = []
body.each do |line|
new_body << line
end
body.close if body.respond_to?(:close) body.close if body.respond_to?(:close)
if !ignored?(env['PATH_INFO']) && !bad_browser?(env['HTTP_USER_AGENT']) new_body = [] ; body.each { |line| new_body << line.to_s }
if headers['Content-Type'] && status == 200 && headers['Content-Type'][%r{text/html}]
if !ignored?(env['PATH_INFO']) and !bad_browser?(env['HTTP_USER_AGENT'])
if headers['Content-Type'] and status == 200 and headers['Content-Type'][%r{text/html}]
content_length = 0 content_length = 0
new_body.each do |line| new_body.each do |line|