rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
From: Joshua Ballanco <jballanc@gmail.com>
To: rack-devel@googlegroups.com
Subject: Re: Does Rack-servers block until the whole request body has been read?
Date: Mon, 25 Apr 2011 10:26:40 -0400	[thread overview]
Message-ID: <BANLkTine=djVphsjzZpqczKwYSor6o6UqA@mail.gmail.com> (raw)
In-Reply-To: <31236863.1318.1302679061651.JavaMail.geo-discussion-forums@yqlq3>

[-- Attachment #1: Type: text/plain, Size: 1755 bytes --]

Hi Daniel,

I faced this same issue when writing ControlTower. When a request gets
handed off to the application does depend on the server in question. Mongrel
waits for the entire body to be received first (even though it uses a
tempfile). Passenger, on the other hand, does not wait (at least, it didn't
the last time I tested it). Passenger also does not directly use a tempfile,
but rather a custom request body class. If you wanted to test directly, have
a look at Net::HTTP using body_stream (there seems to be some info you might
use here:
http://stackoverflow.com/questions/213613/buffered-multipart-form-posts-in-ruby
).

Cheers,

Josh

On Wed, Apr 13, 2011 at 3:17 AM, Daniel Abrahamsson <hamsson@gmail.com>wrote:

> Hi,
>
> I am working on a server that deals with large file uploads (currently
> built upon Rails, with a Metal taking care of the uploads). According to the
> rack-specification:
> "... handler developers must buffer the input data into some rewindable
> object if the underlying input stream is not rewindable".
>
> For Passenger and Mongrel, this means a temp file is created for the
> request (at least for requests as big as those I am dealing with).
>
> Now, my question is, does Rack wait until all data from the client has been
> read to a tempfile before passing on control to the Rack app (in this case,
> Rails)? Or does it pass on control directly, and block if the application
> reads data faster than the client is sending it?
>
> After some initial testing, it appears to me that the former is the case.
> Can anyone give me advice on how to test this? Perhaps it depends on the web
> server used? Perhaps on the framework?
>
> Thank you in advance for any advance or clarification on this matter.
>
> //Daniel
>

[-- Attachment #2: Type: text/html, Size: 2206 bytes --]

  reply	other threads:[~2011-04-25 14:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-13  7:17 Does Rack-servers block until the whole request body has been read? Daniel Abrahamsson
2011-04-25 14:26 ` Joshua Ballanco [this message]
2011-04-26  1:16 ` Eric Wong

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-list from there: mbox

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

  List information: https://groups.google.com/group/rack-devel

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

  git send-email \
    --in-reply-to='BANLkTine=djVphsjzZpqczKwYSor6o6UqA@mail.gmail.com' \
    --to=rack-devel@googlegroups.com \
    /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.
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).