try another change
This commit is contained in:
parent
0a30019d22
commit
82279dee94
|
@ -53,15 +53,19 @@ module Rack
|
||||||
else
|
else
|
||||||
status, headers, body = @app.call(env)
|
status, headers, body = @app.call(env)
|
||||||
|
|
||||||
new_body = body.dup
|
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 !ignored?(env['PATH_INFO']) && !bad_browser?(env['HTTP_USER_AGENT'])
|
||||||
if headers['Content-Type'] && headers['Content-Type'][%r{text/html}]
|
if headers['Content-Type'] && headers['Content-Type'][%r{text/html}]
|
||||||
content_length = 0
|
content_length = 0
|
||||||
|
|
||||||
new_body = []
|
new_body.each do |line|
|
||||||
|
|
||||||
body.each do |line|
|
|
||||||
if !headers['X-Rack-LiveReload'] && line['</head>']
|
if !headers['X-Rack-LiveReload'] && line['</head>']
|
||||||
host_to_use = (@options[:host] || env['HTTP_HOST'] || 'localhost').gsub(%r{:.*}, '')
|
host_to_use = (@options[:host] || env['HTTP_HOST'] || 'localhost').gsub(%r{:.*}, '')
|
||||||
|
|
||||||
|
@ -83,17 +87,12 @@ module Rack
|
||||||
end
|
end
|
||||||
|
|
||||||
content_length += line.bytesize
|
content_length += line.bytesize
|
||||||
|
|
||||||
new_body << line
|
|
||||||
end
|
end
|
||||||
|
|
||||||
headers['Content-Length'] = content_length.to_s
|
headers['Content-Length'] = content_length.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
body.close if body.respond_to?(:close)
|
|
||||||
new_body.close if new_body.respond_to?(:close)
|
|
||||||
|
|
||||||
[ status, headers, new_body ]
|
[ status, headers, new_body ]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue