Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: Kevin Mullican <kmullican@oblong.com>
Cc: rainbows-public@bogomips.org
Subject: Re: issue between rainbows/unicorn 5.0.0 and rack on ruby >= 1.9.1
Date: Wed, 13 Jul 2016 20:24:31 +0000	[thread overview]
Message-ID: <20160713202431.GA10605@dcvr.yhbt.net> (raw)
In-Reply-To: <CAKFTmUxbcbnvwc4S5N9mHGnqE+sqNofVGdy75SHjUy0nDj_pUA@mail.gmail.com>

Kevin Mullican <kmullican@oblong.com> wrote:
> Greetings,
> 
> We have run into a problem while trying to use rainbows/unicorn 5.0.0
> on ruby >= 1.9.1. The issue is with rack. As of ruby 1.9.1, String no
> longer responds to #each, however it seems that rainbows is still
> sending a string body through rack. See:
> 
> rainbows-5.0.0/lib/rainbows/process_client.rb:51: in `write_response`
> 
> which enters rack at:
> 
> rainbows-5.0.0/lib/rainbows/response.rb:85:in `write_body_each'

That is all correct.

> Note that the rack spec specifically requires that body respond to
> #each and yield a set of strings:
> 
> https://github.com/rack/rack/blob/25a549883b85fb33970b4a1530a365c0c9e51f95/SPEC#L245-L248

Also correct.

> So, it seems that the onus is likely on rainbows to conform to the
> rack spec in order to require it's use. One solution would be to wrap
> the bare string in an array before it descends into rack.

Actually, I believe the onus is on the application to produce a
correct response body for the application server to use.
Testing your application with the Rack::Lint middleware enabled
should've detected such an error.

Application frameworks (e.g. Sinatra, Rails, etc) already produce
a response body which responds to #each out-of-the-box.

A brief scan of lib/rack/handlers/*.rb in rack.git reveals the
server handlers bundled with rack itself expect the body to
respond to #each, too.

  reply	other threads:[~2016-07-13 20:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-13 19:51 issue between rainbows/unicorn 5.0.0 and rack on ruby >= 1.9.1 Kevin Mullican
2016-07-13 20:24 ` Eric Wong [this message]
2016-07-14 16:13   ` Dan Kegel
2016-07-14 22:17     ` 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-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/rainbows/

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

  git send-email \
    --in-reply-to=20160713202431.GA10605@dcvr.yhbt.net \
    --to=e@80x24.org \
    --cc=kmullican@oblong.com \
    --cc=rainbows-public@bogomips.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/rainbows.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).