2 use Rainbows::DevFdResponse
3 class ClosablePipe < ::IO
7 rv = popen "echo hello", "rb"
13 return if closed? # idempotent for Ruby 2.3.0 compatibility
15 $stdout.syswrite "path_info=#{@env['PATH_INFO']}\n"
19 class ClosableFile < ::File
24 $stdout.syswrite "path_info=#{@env['PATH_INFO']}\n"
38 $stdout.syswrite "path_info=#{@env['PATH_INFO']}\n"
46 [ %w(Content-Length 6), %w(Content-Type text/plain)],
50 f = ClosableFile.open("env.ru", "rb")
53 'X-Req-Path' => env["PATH_INFO"],
54 'Content-Length' => f.stat.size.to_s,
55 'Content-Type' => 'text/plain' },
60 [%w(Content-Length 5), %w(Content-Type text/plain)],
64 [ 404, [%w(Content-Length 0), %w(Content-Type text/plain)], [] ]