rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* Rack::Lint - Content-Length is nil in Passenger
@ 2009-06-29  0:56 Joe Fiorini
  2009-06-29 15:16 ` Magnus Holm
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Joe Fiorini @ 2009-06-29  0:56 UTC (permalink / raw)
  To: Rack Development


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Rack::Lint - Content-Length is nil in Passenger
  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
  2009-06-30 22:16 ` Hongli Lai
  2 siblings, 0 replies; 4+ messages in thread
From: Magnus Holm @ 2009-06-29 15:16 UTC (permalink / raw)
  To: rack-devel


Try putting the ContentLength-middleware above Lint.

2009/6/29, Joe Fiorini <joe@faithfulgeek.org>:
>
> 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
>


-- 

//Magnus Holm

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Rack::Lint - Content-Length is nil in Passenger
  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
  2009-06-30 22:16 ` Hongli Lai
  2 siblings, 0 replies; 4+ messages in thread
From: Yehuda Katz @ 2009-06-29 15:38 UTC (permalink / raw)
  To: rack-devel

[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Rack::Lint - Content-Length is nil in Passenger
  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
@ 2009-06-30 22:16 ` Hongli Lai
  2 siblings, 0 replies; 4+ messages in thread
From: Hongli Lai @ 2009-06-30 22:16 UTC (permalink / raw)
  To: Rack Development


On Jun 29, 2:56 am, Joe Fiorini <j...@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?

Are you using 2.2.3 or later? Several Rack compliance bugs have been
fixed in 2.2.3.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-30 22:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2009-06-30 22:16 ` Hongli Lai

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).