[go: up one dir, main page]

File: write-on-close.ru

package info (click to toggle)
unicorn 4.3.1-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,828 kB
  • sloc: ruby: 8,393; ansic: 3,931; sh: 2,062; makefile: 4
file content (11 lines) | stat: -rw-r--r-- 251 bytes parent folder | download | duplicates (11)
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 ] })