rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
From: Yehuda Katz <wycats@gmail.com>
To: rack-devel@googlegroups.com
Subject: Re: Rack::Lint - Content-Length is nil in Passenger
Date: Mon, 29 Jun 2009 08:38:42 -0700	[thread overview]
Message-ID: <245fb4700906290838s5f9bc1e1v8fa123cf1f945143@mail.gmail.com> (raw)
In-Reply-To: <694b2ab5-2bb7-4d77-8b3c-976dde14eeb7@b14g2000yqd.googlegroups.com>

[-- Attachment #1: Type: text/plain, Size: 1422 bytes --]

According to the spec, Content-Length is *not* required. It is only required
to be correct if it is present. Part of the reason for this is that
repeatedly calculating Content-Length is quite expensive compared to a
single outbound server (like Passenger itself) calculating it before sending
it on.
-- Yehuda

On Sun, Jun 28, 2009 at 5:56 PM, Joe Fiorini <joe@faithfulgeek.org> wrote:

>
> I'm at the starting phase of building a web app using Rack. I'm trying
> to add in some useful middleware on top of the Lobster demo. I want to
> ensure my app always matches the spec, so I'm using Rack::Lint.
> However, this immediately bombs out telling me the Content-Length is
> nil. My config.ru looks like this:
>
> require 'rack'
> require 'rack/lobster'
>
> use Rack::ShowExceptions
> use Rack::CommonLogger
> use Rack::ShowStatus
> use Rack::Lint
> use Rack::ContentLength
> run Rack::Lobster.new
>
>
> But even if I take it down to this:
>
> require 'rack'
> require 'rack/lobster'
>
> use Rack::Lint
> use Rack::ContentLength
> run Rack::Lobster.new
>
> it still breaks! I'm running the app on Passenger. It does work,
> however, if I run straight through the rackup executable. Perhaps
> Passenger is mangling my env hash? If I take out Rack::Lint and run it
> (via Passenger), the headers do show a valid Content-Length. Weird,
> eh?
>
> Perplexed,
> Joe
>



-- 
Yehuda Katz
Developer | Engine Yard
(ph) 718.877.1325

[-- Attachment #2: Type: text/html, Size: 1954 bytes --]

  parent reply	other threads:[~2009-06-29 15:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-29  0:56 Rack::Lint - Content-Length is nil in Passenger Joe Fiorini
2009-06-29 15:16 ` Magnus Holm
2009-06-29 15:38 ` Yehuda Katz [this message]
2009-06-30 22:16 ` Hongli Lai

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=245fb4700906290838s5f9bc1e1v8fa123cf1f945143@mail.gmail.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).