Richard Penwell <[email protected]> wrote: > On Jul 15, 2010, at 6:40 PM, Eric Wong <[email protected]> wrote: > > Richard Penwell <[email protected]> wrote: > >> So I discovered this was a problem whereby request.body.to_s behaves > >> differently. I wonder if TeeStream should define to_s as an alias for > >> read? > > > > to_s isn't defined by any version of the Rack spec. > > > > It's horrible practice to use it, too, since it could be a big upload > > that uses all your memory. > > > > What are you using that does request.body.to_s? Can you change it? > > > We have an application that forwards requests to staging, dev or > production. So it takes the body of the request and forwards it > along...
(top-posting corrected) I would always make it use a read/write loop with some fixed chunk size. If you don't care about memory usage or if you have nginx properly configured to reject large requests (the default of 1M is actually quite reasonable), then use "request.body.read" instead since that's the supported way to use all Rack apps/middlewares. You can try your apps with Rack::Lint middleware loaded during development/testing to catch these things. -- Eric Wong _______________________________________________ Unicorn mailing list - [email protected] http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying
