From: Max Cantor <max@maxcantor.net>
To: Rack Development <rack-devel@googlegroups.com>
Subject: Re: Patch: Make CGI handler obey rack spec for the greater good
Date: Thu, 20 May 2010 10:36:54 -0700 (PDT) [thread overview]
Message-ID: <42cbee50-0818-4c65-a5f5-252f0b18f885@o39g2000vbd.googlegroups.com> (raw)
In-Reply-To: <A44A2A29-0C84-4D4E-8667-527D4810A656@gmail.com>
On May 20, 10:09 am, James Tucker <jftuc...@gmail.com> wrote:
> On 12 May 2010, at 10:24, Max Cantor wrote:
>
> > The default CGI handler included in rack doesn't obey the rack spec;
> > its input stream is not rewindable, and thus generates Errno::ESPIPE
> > illegal seek errors. You can see the Sinatra guys needed a workaround
> > for it here:https://sinatra.lighthouseapp.com/projects/9779/tickets/227-errnoespi...
>
> > This patch wraps the CGI handler's input stream in a rewindable input
> > object, which makes the handler adhere to the rack spec.
>
> Didn't we say this was optional in the spec?
>
> This could be a middleware, as has been discussed elsewhere on this ML in the last 6 months.
From the spec at http://rack.rubyforge.org/doc/SPEC.html:
> The input stream is an IO-like object which contains the raw HTTP POST data. When applicable, its external encoding must be “ASCII-8BIT” and it must be opened in binary mode, for Ruby 1.9 compatibility. The input stream must respond to gets, each, read and rewind.
> rewind must be called without arguments. It rewinds the input stream back to the beginning. It must not raise Errno::ESPIPE: that is, it may not be a pipe or a socket. Therefore, handler developers must buffer the input data into some rewindable object if the underlying input stream is not rewindable.
Perhaps it is out of date or I am interpreting it incorrectly, but I
took the "must" in those paragraphs to heart--my mistake if I'm
reading the wrong part of the spec or something.
Do you feel like there's a good reason to not make the CGI handler's
input stream rewindable? Every time I update rack, I have to re-patch
it myself, because it never works. It seems pretty unintuitive to
require adding middleware just to make the CGI handler work at all.
- Max
next prev parent reply other threads:[~2010-05-20 17:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-12 13:24 Patch: Make CGI handler obey rack spec for the greater good Max Cantor
2010-05-20 14:09 ` James Tucker
2010-05-20 17:36 ` Max Cantor [this message]
2010-05-20 21:10 ` James Tucker
2010-06-12 18:46 ` Max Cantor
2010-06-13 21:11 ` James Tucker
2010-06-29 10:27 ` Hongli Lai
2010-06-29 10:44 ` James Tucker
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=42cbee50-0818-4c65-a5f5-252f0b18f885@o39g2000vbd.googlegroups.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).