Sha256: 862c180addd8c0e2c7de4fc619700eeab252a9be94a0c089d51ddd64c67a13a0
Contents?: true
Size: 795 Bytes
Versions: 3
Compression:
Stored size: 795 Bytes
Contents
require 'digest' bs = 4096 hdr = {'Content-Type' => 'text/plain', 'Content-Length' => '0'} sha1_app = lambda do |env| sha1 = Digest::SHA1.new input = env['rack.input'] resp = {} i = 0 while buf = input.read(bs) sha1.update(buf) i += buf.size end resp[:sha1] = sha1.hexdigest # rewind and read again input.rewind sha1.reset while buf = input.read(bs) sha1.update(buf) end if resp[:sha1] == sha1.hexdigest resp[:sysread_read_byte_match] = true end if expect_size = env['HTTP_X_EXPECT_SIZE'] if expect_size.to_i == i resp[:expect_size_match] = true end end resp[:size] = i resp[:expect_size] = expect_size resp[:content_md5] = env['HTTP_X_CONTENT_MD5'] [ 200, hdr.merge({'X-Resp' => resp.inspect}), [] ] end run sha1_app
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
jubilee-3.0.0.beta2-java | test/apps/sha1.ru |
jubilee-2.1.0.rc1-java | test/apps/sha1.ru |
jubilee-2.1.0.beta-java | test/apps/sha1.ru |