1 # SHA1 checksum generator
3 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(rand(cap))
12 raise "#{buf.size} > #{cap}" if buf.size > cap
14 end while input.read(rand(cap), buf)
17 [ 200, {'Content-Type' => 'text/plain'}, [ digest.hexdigest << "\n" ] ]