support for Rack hijack in request and response
[unicorn.git] / t / oob_gc.ru
blobc6035b6d6b0a6675ee5bb27dead34b0165b31714
1 #\-E none
2 require 'unicorn/oob_gc'
3 use Rack::ContentLength
4 use Rack::ContentType, "text/plain"
5 use Unicorn::OobGC
6 $gc_started = false
8 # Mock GC.start
9 def GC.start
10   ObjectSpace.each_object(BasicSocket) do |x|
11     next if Unicorn::HttpServer::LISTENERS.include?(x)
12     x.closed? or abort "not closed #{x}"
13   end
14   $gc_started = true
15 end
16 run lambda { |env|
17   if "/gc_reset" == env["PATH_INFO"] && "POST" == env["REQUEST_METHOD"]
18     $gc_started = false
19   end
20   [ 200, {}, [ "#$gc_started\n" ] ]