streaming input for large requests
john at brightbox.co.uk
Wed Aug 11 04:54:48 EDT 2010
On Tue, 2010-08-10 at 16:25 -0700, Eric Wong wrote:
> Yes, we store uploads to an unlinked temporary file if the body is
> larger than 112 Kbytes (this threshold was established by Mongrel back
> in the day).
> Rack currently requires rewindability, but this requirement will
> most likely be optional in Rack 2.x, and we'll update our code
> to match, then.
> Meanwhile, you can either:
> 1. Write a module to disable writes to tmp for the Unicorn::TeeInput
> class (or monkey patch it) it.
> 2. Without loading Rack::Lint (or anything that wraps env["rack.input"]):
> Redirect the temporary file to /dev/null:
> input = env["rack.input"]
> if input.respond_to?(:tmp)
> tmp = input.tmp
> # StringIO is used for bodies <112K, can't reopen those
> tmp.respond_to?(:reopen) and tmp.reopen('/dev/null', 'wb')
thanks for the detailed response Eric. I'll give this a go.
More information about the rainbows-talk