Rainbows! Rack HTTP server user/dev discussion
 help / Atom feed
From: Dan Kegel <dank@kegel.com>
To: Eric Wong <e@80x24.org>
Cc: Kevin Mullican <kmullican@oblong.com>, rainbows-public@bogomips.org
Subject: Re: issue between rainbows/unicorn 5.0.0 and rack on ruby >= 1.9.1
Date: Thu, 14 Jul 2016 09:13:19 -0700
Message-ID: <CAPF-yOboMRRjzYhs5Mf955uoFu9j5CRBV=Uh6TRNgtDs1z9BRg@mail.gmail.com> (raw)
In-Reply-To: <20160713202431.GA10605@dcvr.yhbt.net>

On Wed, Jul 13, 2016 at 1:24 PM, Eric Wong <e@80x24.org> wrote:
> Actually, I believe the onus is on the application to produce a
> correct response body for the application server to use.

I work with Kevin, and helped track this down.  Neither of us use Ruby
much, hence our difficulty.
I'm posting a followup here in case others in a similar spot happen
across this thread.

One problem was in our rackup.ru (I'll show a bit more code than
needed, to be kind to newbies):

class AppendSlash
  def initialize(app, options={})
    @app = app
    @base = options[:base]
  end
  def call(env)
    if env['REQUEST_URI'] == @base
      [301, {
        'Content-Type' => 'text/html',
        'Location' =>  @base + '/'
        }, '']
    else
      @app.call(env)
    end
  end
end

The fix was to change
        }, '']
to
        }, ['']]

Likewise, in a few of our apps, we had to change

      [200, {
          'Content-Type' => 'text/plain',
          'Content-Length' => data.length.to_s
        }, data
      ]

to

      [200, {
          'Content-Type' => 'text/plain',
          'Content-Length' => data.length.to_s
        }, [data]
      ]

The question was also asked at https://github.com/rack/rack/issues/1096
so I'll follow up there, too.

Thanks!
- Dan

  reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-13 19:51 Kevin Mullican
2016-07-13 20:24 ` Eric Wong
2016-07-14 16:13   ` Dan Kegel [this message]
2016-07-14 22:17     ` Eric Wong

Reply instructions:

You may reply publically 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://bogomips.org/rainbows/

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

  git send-email \
    --in-reply-to='CAPF-yOboMRRjzYhs5Mf955uoFu9j5CRBV=Uh6TRNgtDs1z9BRg@mail.gmail.com' \
    --to=dank@kegel.com \
    --cc=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

Rainbows! Rack HTTP server user/dev discussion

Archives are clonable:
	git clone --mirror https://bogomips.org/rainbows-public
	git clone --mirror http://ou63pmih66umazou.onion/rainbows-public

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.rainbows
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.rainbows

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox