From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.239.138.72 with SMTP id o8cs124542hbo; Thu, 20 May 2010 14:11:09 -0700 (PDT) Received-SPF: pass (google.com: domain of rack-devel+bncCP_V2_zRBRDqytbfBBoE-hkBvQ@googlegroups.com designates 10.90.19.14 as permitted sender) client-ip=10.90.19.14; Authentication-Results: mr.google.com; spf=pass (google.com: domain of rack-devel+bncCP_V2_zRBRDqytbfBBoE-hkBvQ@googlegroups.com designates 10.90.19.14 as permitted sender) smtp.mail=rack-devel+bncCP_V2_zRBRDqytbfBBoE-hkBvQ@googlegroups.com; dkim=pass header.i=rack-devel+bncCP_V2_zRBRDqytbfBBoE-hkBvQ@googlegroups.com Received: from mr.google.com ([10.90.19.14]) by 10.90.19.14 with SMTP id 14mr418752ags.59.1274389868348 (num_hops = 1); Thu, 20 May 2010 14:11:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:x-beenthere:received:received:received :received:received-spf:received:received:received:mime-version :subject:from:in-reply-to:date:message-id:references:to:x-mailer :x-original-authentication-results:x-original-sender:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :sender:list-subscribe:list-unsubscribe:content-type :content-transfer-encoding; bh=1C2LZZDaKpHfgcJ7cArRj5njz4Q0R1dUN5wGaCS7ZoE=; b=cIOuLGa/4lheImiPSlrrBPuJs/sT9oW8gWzDoCqF7nGCefbWvfUG9cWqz8Eff3LO1j jV7q8kCeodcWpfuQsznhTWoyCZqR+qAzW7iSgPlAaNoaiNOfiGvQJsGtIFLrm0p+VXO8 WC1E2vbORrtIIZiFrvRNoS4aPv1GgEEkY/2ns= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:mime-version:subject:from:in-reply-to:date :message-id:references:to:x-mailer:x-original-authentication-results :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type:content-transfer-encoding; b=RydHFwAXr13OW/YASHDGQXZkKxx9uCVhIw3sSjbQkcPAqAYOhNTiHZ1vAZj5B8VFlK Xtz+/PsYOgBQqcgzC5pYuSgPNyrx+fdaZQ3a8rjXiClu5Nllet34FgnnKK3AzcXWGwgB CjlYL4/4hGFfnx46mEP7Ujvk318TryqKjS1/g= Received: by 10.90.19.14 with SMTP id 14mr86244ags.59.1274389866822; Thu, 20 May 2010 14:11:06 -0700 (PDT) X-BeenThere: rack-devel@googlegroups.com Received: by 10.91.39.13 with SMTP id r13ls127791agj.5.p; Thu, 20 May 2010 14:11:05 -0700 (PDT) Received: by 10.90.37.36 with SMTP id k36mr750284agk.14.1274389865860; Thu, 20 May 2010 14:11:05 -0700 (PDT) Received: by 10.90.37.36 with SMTP id k36mr750282agk.14.1274389865828; Thu, 20 May 2010 14:11:05 -0700 (PDT) Return-Path: Received: from mail-qy0-f192.google.com (mail-qy0-f192.google.com [209.85.221.192]) by gmr-mx.google.com with ESMTP id 25si36652ywh.15.2010.05.20.14.11.04; Thu, 20 May 2010 14:11:04 -0700 (PDT) Received-SPF: pass (google.com: domain of jftucker@gmail.com designates 209.85.221.192 as permitted sender) client-ip=209.85.221.192; Received: by qyk30 with SMTP id 30so422097qyk.16 for ; Thu, 20 May 2010 14:11:04 -0700 (PDT) Received: by 10.224.66.100 with SMTP id m36mr551861qai.126.1274389864164; Thu, 20 May 2010 14:11:04 -0700 (PDT) Return-Path: Received: from [10.0.0.17] ([199.172.206.12]) by mx.google.com with ESMTPS id 7sm765308qwf.6.2010.05.20.14.10.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 20 May 2010 14:11:01 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1078) Subject: Re: Patch: Make CGI handler obey rack spec for the greater good From: James Tucker In-Reply-To: <42cbee50-0818-4c65-a5f5-252f0b18f885@o39g2000vbd.googlegroups.com> Date: Thu, 20 May 2010 18:10:57 -0300 Message-Id: References: <42cbee50-0818-4c65-a5f5-252f0b18f885@o39g2000vbd.googlegroups.com> To: rack-devel@googlegroups.com X-Mailer: Apple Mail (2.1078) X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jftucker@gmail.com designates 209.85.221.192 as permitted sender) smtp.mail=jftucker@gmail.com; dkim=pass (test mode) header.i=@gmail.com X-Original-Sender: jftucker@gmail.com Reply-To: rack-devel@googlegroups.com Precedence: list Mailing-list: list rack-devel@googlegroups.com; contact rack-devel+owners@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: Sender: rack-devel@googlegroups.com List-Subscribe: , List-Unsubscribe: , Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 20 May 2010, at 14:36, Max Cantor wrote: >=20 >=20 > On May 20, 10:09 am, James Tucker wrote: >> On 12 May 2010, at 10:24, Max Cantor wrote: >>=20 >>> 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= ... >>=20 >>> This patch wraps the CGI handler's input stream in a rewindable = input >>> object, which makes the handler adhere to the rack spec. >>=20 >> Didn't we say this was optional in the spec? >>=20 >> This could be a middleware, as has been discussed elsewhere on this = ML in the last 6 months. >=20 >=20 > =46rom the spec at http://rack.rubyforge.org/doc/SPEC.html: >=20 >> The input stream is an IO-like object which contains the raw HTTP = POST data. When applicable, its external encoding must be =93ASCII-8BIT=94= and it must be opened in binary mode, for Ruby 1.9 compatibility. The = input stream must respond to gets, each, read and rewind. >=20 >> 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. >=20 > 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. Nope, maybe it just went the other way last time this discussion came up = and I forgot. > 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. I just don't see really good reasons to buffer for the sake of = buffering.=