From e998fab430e45531fbb0ec6b8fc28e9fe9846f03 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Tue, 18 Sep 2012 17:22:19 -0400 Subject: [PATCH] make sure things inserted into the body are actually strings --- lib/rack/livereload.rb | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/rack/livereload.rb b/lib/rack/livereload.rb index d9fdb21..fc33f0f 100644 --- a/lib/rack/livereload.rb +++ b/lib/rack/livereload.rb @@ -52,17 +52,12 @@ module Rack deliver_file(target) else status, headers, body = @app.call(env) - - new_body = [] - - body.each do |line| - new_body << line - end - body.close if body.respond_to?(:close) - if !ignored?(env['PATH_INFO']) && !bad_browser?(env['HTTP_USER_AGENT']) - if headers['Content-Type'] && status == 200 && headers['Content-Type'][%r{text/html}] + new_body = [] ; body.each { |line| new_body << line.to_s } + + 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 new_body.each do |line|