From 55299ddfc9ca6ebb59883e425c73c4eaedd86aaa Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 18 Aug 2009 15:27:09 -0700 Subject: rainbows: make the embedded SHA1 app Rack::Lint-safe Otherwise we're promoting broken practices --- lib/unicorn/rainbows.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/unicorn/rainbows.rb b/lib/unicorn/rainbows.rb index 6c9a0d6..862de9d 100644 --- a/lib/unicorn/rainbows.rb +++ b/lib/unicorn/rainbows.rb @@ -116,11 +116,7 @@ end if $0 == __FILE__ app = lambda { |env| if /\A100-continue\z/i =~ env['HTTP_EXPECT'] - header = { - 'Content-Type' => 'application/octet-stream', - 'Content-Length' => '0' - } - return [ 100, header, [] ] + return [ 100, {}, [] ] end digest = Digest::SHA1.new input = env['rack.input'] @@ -128,7 +124,13 @@ if $0 == __FILE__ while buf = input.read(16384, buf) digest.update(buf) end - [ 200, { 'X-SHA1' => digest.hexdigest }, [ env.inspect << "\n" ] ] + body = env.inspect << "\n" + header = { + 'X-SHA1' => digest.hexdigest, + 'Content-Length' => body.size.to_s, + 'Content-Type' => 'text/plain', + } + [ 200, header, [ body ] ] } options = { :listeners => %w(0.0.0.0:8080), -- cgit v1.2.3-24-ge0c7