Forum: NGINX Ebb and Transfer-Encoding: chunked

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E811b5337bcad19d52c8fed3a0ea0075?d=identicon&s=25 John Miller (jfmiller28)
on 2008-11-22 01:06
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=71...

Thanks to Igor for the patch.  I hope this can save someone else an
afternoon of fiddling.
Fda08117336cfde6562315df04b976e8?d=identicon&s=25 Dave Cheney (Guest)
on 2008-11-22 05:16
(Received via mailing list)
On 22/11/2008, at 11:06 AM, John Miller 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
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2008-11-22 12:34
(Received via mailing list)
Hello!

On Sat, Nov 22, 2008 at 01:06:03AM +0100, John Miller 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=71...
>
> 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 Dounin
This topic is locked and can not be replied to.