unicorn.git  about / heads / tags
Rack HTTP server for Unix and fast clients
blob e936a85877ca622b916519e92376c8f3da73d18b 506 bytes (raw)
$ git show v4.5.0:t/oob_gc_path.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
 
#\-E none
require 'unicorn/oob_gc'
use Rack::ContentLength
use Rack::ContentType, "text/plain"
use Unicorn::OobGC, 5, /BAD/
$gc_started = false

# Mock GC.start
def GC.start
  ObjectSpace.each_object(BasicSocket) do |x|
    next if Unicorn::HttpServer::LISTENERS.include?(x)
    x.closed? or abort "not closed #{x}"
  end
  $gc_started = true
end
run lambda { |env|
  if "/gc_reset" == env["PATH_INFO"] && "POST" == env["REQUEST_METHOD"]
    $gc_started = false
  end
  [ 200, {}, [ "#$gc_started\n" ] ]
}

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