unicorn.git  about / heads / tags
Rack HTTP server for Unix and fast clients
blob 54a2f2e2cb131eb4af55f04df2aade285dbb6868 251 bytes (raw)
$ git show no-kgio-wip:t/write-on-close.ru	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 
class WriteOnClose
  def each(&block)
    @callback = block
  end

  def close
    @callback.call "7\r\nGoodbye\r\n0\r\n\r\n"
  end
end
use Rack::ContentType, "text/plain"
run(lambda { |_| [ 200, [%w(Transfer-Encoding chunked)], WriteOnClose.new ] })

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