From: Eric Wong <normalperson@yhbt.net>
To: rack-devel@googlegroups.com
Subject: Re: Middleware and post-request processing
Date: Fri, 3 Jun 2011 22:33:38 -0700 [thread overview]
Message-ID: <20110604053337.GA15594@dcvr.yhbt.net> (raw)
In-Reply-To: <2cac8438-1819-4887-bce9-9a99578539db@f31g2000pri.googlegroups.com>
ghazel <ghazel@gmail.com> wrote:
> It seems to me that Rack is in need of a new post-response stage of
> processing. This stage would occur after the response is fully written
> and the client is unblocked, and before the next request is processed.
I remember Aaron Patterson started thinking/blogging about it, at least.
search: "rack api awkward"
> Similar to what OobGC ( http://bogomips.org/unicorn.git/tree/lib/unicorn/oob_gc.rb#n59
> ) accomplishes, it is sometimes useful to perform additional
> operations after the response is written without blocking the client.
I should note OobGC used to (really) be middleware, but I had to rewrite
it (as a Unicorn module) because Unicorn also needs to support
middleware that captures the block passed to body#each and reuses the
block in body#close.
> This proposal would entail something like a single function which is
> called on each middleware after the response is written to the client
> and the socket is closed (depending on the server implementation). For
> servers which have no ability to not block the client or delay further
> requests the function should still be called, and the impact would be
> similar to the behavior today.
Any new post-response stage should give information about whether a
client is persistent or not (and maybe even if it started pipelining the
next request).
It would be great to have a standardized API that makes logging whether
a connection is keepalive/pipelined, but Rack doesn't get into that
right now.
As an author of Rack servers, I'll continue the my conservative personal
policy of not implementing new APIs unless:
1) it's added to the Rack spec, or
2) another widely-used server implements it (e.g. Thin
with the async/deferred? stuff)
--
Eric Wong
next prev parent reply other threads:[~2011-06-04 5:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-03 23:23 Middleware and post-request processing ghazel
2011-06-04 5:33 ` Eric Wong [this message]
2011-06-06 17:05 ` George
2011-06-07 17:20 ` James Tucker
2012-08-07 10:49 ` ghazel
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=20110604053337.GA15594@dcvr.yhbt.net \
--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).