# Ebb and Transfer-Encoding: chunked

**URL:** <https://www.ruby-forum.com/t/ebb-and-transfer-encoding-chunked/153870>\
**Category:** NGINX\
**Created:** [November 22, 2008, 1:06am UTC](https://www.ruby-forum.com/t/ebb-and-transfer-encoding-chunked/153870 "2008-11-22T01:06:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [November 22, 2008, 1:06am UTC](https://www.ruby-forum.com/t/ebb-and-transfer-encoding-chunked/153870/1 "2008-11-22T01:06:03Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [November 22, 2008, 5:16am UTC](https://www.ruby-forum.com/t/ebb-and-transfer-encoding-chunked/153870/2 "2008-11-22T05:16:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [November 22, 2008, 12:34pm UTC](https://www.ruby-forum.com/t/ebb-and-transfer-encoding-chunked/153870/3 "2008-11-22T12:34:55Z")

</div>

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](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.
