Skip to content

Instantly share code, notes, and snippets.

@julik

julik/config.ru Secret

Created January 23, 2019 16:35
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 julik/477b0b13edbef798b34ba22cc99391e6 to your computer and use it in GitHub Desktop.
Save julik/477b0b13edbef798b34ba22cc99391e6 to your computer and use it in GitHub Desktop.
run ->(env) {
blob = Random.new.bytes(1024)
clen = 1024 * 1024
async_body = Async::HTTP::Body::Writable.new(clen) #, queue: Async::LimitedQueue.new(4))
Async::Reactor.run do |task|
begin
(clen / blob.bytesize).times { async_body.write(blob) }
ensure
async_body.close
end
end
[200, {'Content-Length' => clen.to_s}, async_body]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment