[go: up one dir, main page]

File: preread_input.ru

package info (click to toggle)
unicorn 4.3.1-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,828 kB
  • sloc: ruby: 8,393; ansic: 3,931; sh: 2,062; makefile: 4
file content (17 lines) | stat: -rw-r--r-- 375 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#\-E none
require 'digest/sha1'
require 'unicorn/preread_input'
use Rack::ContentLength
use Rack::ContentType, "text/plain"
use Unicorn::PrereadInput
nr = 0
run lambda { |env|
  $stderr.write "app dispatch: #{nr += 1}\n"
  input = env["rack.input"]
  dig = Digest::SHA1.new
  while buf = input.read(16384)
    dig.update(buf)
  end

  [ 200, {}, [ "#{dig.hexdigest}\n" ] ]
}