Ebb and Transfer-Encoding: chunked


#1

While I bet it is not encountered too often, there is a bug existing
between NginX and Ebb. Most frameworks (Rails, Merb, Sinatra,
others?..) pass a string as the final(body) element of their Rack
response. Rack merely requires that the body respond to :each by
yielding strings. When and array (or something more complex) is passed
to Ebb as the body, it sets ‘Transfer-Encoding: chunked’ and then sends
each yielded value as a chuck.

NginX speaks to its back end services using HTTP/1.0 which does not
include Transfer-Encoding. It therefore adds it’s own transfer encoding
and life becomes very messy.

To fix this, there is a patch in this thread:
http://www.ruby-forum.com/topic/152435?reply_to=717744#672279

Thanks to Igor for the patch. I hope this can save someone else an
afternoon of fiddling.


#2

On 22/11/2008, at 11:06 AM, John M. wrote:

When and array (or something more complex) is passed
to Ebb as the body, it sets ‘Transfer-Encoding: chunked’ and then
sends
each yielded value as a chuck.

NginX speaks to its back end services using HTTP/1.0 which does not
include Transfer-Encoding. It therefore adds it’s own transfer
encoding
and life becomes very messy.

If are responding to a HTTP/1.0 request you mustn’t use Transfer-
Encoding. The proper way to send a dynamic sized body to a HTTP/1.0
upstream client is to give no Content-Length header then close the
connection after sending the body. This sounds like Ebb is not doing
the right thing, not nginx.

Cheers

Dave


#3

Hello!

On Sat, Nov 22, 2008 at 01:06:03AM +0100, John M. wrote:

and life becomes very messy.

To fix this, there is a patch in this thread:
http://www.ruby-forum.com/topic/152435?reply_to=717744#672279

Thanks to Igor for the patch. I hope this can save someone else an
afternoon of fiddling.

Just to make things clear:

  1. Root of the problem is backend (Ebb in this case) violating
    http specs.

  2. The patch in question will resolve only part of the problems
    that arise as a result. You should still expect wierd things to
    happen when using proxy_store, gzipping such replies, using ssi on
    them and so on.

Maxim D.