unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: Richard Penwell <almightylinuxgod@me.com>
Cc: unicorn list <mongrel-unicorn@rubyforge.org>
Subject: Re: Problem with x-www-form-urlencoded
Date: Fri, 16 Jul 2010 07:54:59 +0000	[thread overview]
Message-ID: <20100716075458.GB30751@dcvr.yhbt.net> (raw)
In-Reply-To: <7A69579A-CFCF-4FA0-896B-0D3F97191FE7@me.com>

Richard Penwell <almightylinuxgod@me.com> wrote:
> On Jul 15, 2010, at 6:40 PM, Eric Wong <normalperson@yhbt.net> wrote:
> > Richard Penwell <almightylinuxgod@me.com> 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 - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


  reply	other threads:[~2010-07-16  8:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-15 20:46 Problem with x-www-form-urlencoded Richard Penwell
2010-07-15 22:14 ` Eric Wong
2010-07-15 22:30   ` Richard Penwell
2010-07-15 22:40     ` Eric Wong
2010-07-15 23:49       ` Richard Penwell
2010-07-16  7:54         ` Eric Wong [this message]
2010-07-16 13:17           ` Richard Penwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100716075458.GB30751@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=almightylinuxgod@me.com \
    --cc=mongrel-unicorn@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).