rainbows.git  about / heads / tags
Unicorn for sleepy apps and slow clients
blob 1eda5538c6f0ddb521bdacab261d4759ba9bedf8 366 bytes (raw)
$ git show v3.2.0:t/async-response-no-autochunk.ru	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
use Rack::Chunked
use Rainbows::DevFdResponse
script = <<-EOF
for i in 0 1 2 3 4 5 6 7 8 9
do
	printf '1\r\n%s\r\n' $i
	sleep 1
done
printf '0\r\n\r\n'
EOF

run lambda { |env|
  env['rainbows.autochunk'] = false
  io = IO.popen(script, 'rb')
  [
    200,
    {
      'Content-Type' => 'text/plain',
      'Transfer-Encoding' => 'chunked',
    },
    io
  ].freeze
}

git clone https://yhbt.net/rainbows.git