coolio+xepoll_thread*: use shutdown() for keepalive timeout
[rainbows.git] / t / file-wrap-to_path.ru
blobf12e08d756f873c1b9e561dd84e498fc020cb349
1 # must be run without Rack::Lint since that clobbers to_path
2 class Wrapper < Struct.new(:app)
3   def call(env)
4     status, headers, body = app.call(env)
5     body = Body.new(body) if body.respond_to?(:to_path)
6     [ status, headers, body ]
7   end
9   class Body < Struct.new(:body)
10     def to_path
11       body.to_path
12     end
14     def each(&block)
15       body.each(&block)
16     end
18     def close
19       ::File.open(ENV['fifo'], 'wb') { |fp| fp.puts "CLOSING" }
20     end
21   end
22 end
23 use Wrapper
24 run Rack::File.new(Dir.pwd)