1 # SHA1 checksum generator
2 bs = ENV['bs'] ? ENV['bs'].to_i : 16384
4 use Rack::ContentLength
6 /\A100-continue\z/i =~ env['HTTP_EXPECT'] and
8 digest = Digest::SHA1.new
9 input = env['rack.input']
10 if buf = input.read(bs)
13 end while input.read(bs, buf)
16 [ 200, {'Content-Type' => 'text/plain'}, [ digest.hexdigest << "\n" ] ]