Skip to content

Instantly share code, notes, and snippets.

@drogus
Created October 17, 2011 18:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drogus/1293368 to your computer and use it in GitHub Desktop.
Save drogus/1293368 to your computer and use it in GitHub Desktop.
request streaming
# runs only on jruby
#
# Usage:
# gem install kirk
# kirk -c Kirkfile
app = lambda do |env|
response_body = []
body = env["rack.input"]
while chunk = body.read(4)
p "Received chunk: #{chunk}"
response_body << chunk
end
[200, {}, response_body]
end
run app
log :level => :all
rack "config.ru" do
listen 3030
# Set the file that controls the redeploys. This is relative to
# the applications root (the directory that the rackup file lives
# in). Touch this file to redepoy the application.
watch "config.ru"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment