# Add support for chunked input encoding in nginx

**URL:** <https://www.ruby-forum.com/t/add-support-for-chunked-input-encoding-in-nginx/133547>\
**Category:** NGINX\
**Created:** [April 1, 2008, 3:23pm UTC](https://www.ruby-forum.com/t/add-support-for-chunked-input-encoding-in-nginx/133547 "2008-04-01T15:23:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manlio\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6f9a4e/32.png) [@Manlio\_P](https://www.ruby-forum.com/u/Manlio_P)\
**Post date:** [April 1, 2008, 3:23pm UTC](https://www.ruby-forum.com/t/add-support-for-chunked-input-encoding-in-nginx/133547/1 "2008-04-01T15:23:26Z")

</div>

Hi.

How hard is to add support for chunked input encoding in Nginx?  
I’m not talking about generic support, but only support for a very  
specialized module I’m planning to write.

Reading the sources I see this:

if (r-\>method & (NGX\_HTTP\_POST|NGX\_HTTP\_PUT)  
&& r-\>headers\_in.content\_length\_n == -1)  
{  
ngx\_log\_error(NGX\_LOG\_INFO, r-\>connection-\>log, 0,  
“client sent POST method without “Content-Length”  
header”);  
ngx\_http\_finalize\_request(r, NGX\_HTTP\_LENGTH\_REQUIRED);  
return NGX\_ERROR;  
}

This code can be relaxed, but is it safe?

Thanks Manlio P.

---

<div class="post-metadata">

**Author:** ![Manlio\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6f9a4e/32.png) [@Manlio\_P](https://www.ruby-forum.com/u/Manlio_P)\
**Post date:** [August 5, 2008, 9:55am UTC](https://www.ruby-forum.com/t/add-support-for-chunked-input-encoding-in-nginx/133547/2 "2008-08-05T09:55:06Z")

</div>

Hi Manlio

Were you able to find a work-around for this ?  
I’m facing the exact same issue where a client is posting a largish body  
using chunked transfer-encoding without content-length, and so NGINX  
croaks at this same point.

Any help will be appreciated.

Regards,  
Mansoor

----- “Manlio P.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
| From: “Manlio P.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
| To: removed\_email\_address@domain.invalid  
| Sent: Tuesday, April 1, 2008 6:44:10 PM GMT +05:30 Chennai, Kolkata, Mumbai, New Delhi  
| Subject: [dev] add support for chunked input encoding in nginx  
|  
| Hi.  
|  
| How hard is to add support for chunked input encoding in Nginx?  
| I’m not talking about generic support, but only support for a very  
| specialized module I’m planning to write.  
|  
|  
| Reading the sources I see this:  
|  
| if (r-\>method & (NGX\_HTTP\_POST|NGX\_HTTP\_PUT)  
| && r-\>headers\_in.content\_length\_n == -1)  
| {  
| ngx\_log\_error(NGX\_LOG\_INFO, r-\>connection-\>log, 0,  
| “client sent POST method without "Content-Length" header”);  
| ngx\_http\_finalize\_request(r, NGX\_HTTP\_LENGTH\_REQUIRED);  
| return NGX\_ERROR;  
| }  
|  
|  
| This code can be relaxed, but is it safe?  
|  
|  
|  
| Thanks Manlio P.  
|  
|

---

<div class="post-metadata">

**Author:** ![Manlio\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6f9a4e/32.png) [@Manlio\_P](https://www.ruby-forum.com/u/Manlio_P)\
**Post date:** [August 5, 2008, 11:33pm UTC](https://www.ruby-forum.com/t/add-support-for-chunked-input-encoding-in-nginx/133547/3 "2008-08-05T23:33:02Z")

</div>

Mansoor P. ha scritto:

> Hi Manlio
> 
> Were you able to find a work-around for this ?

No.

> I’m facing the exact same issue where a client is posting a largish body  
> using chunked transfer-encoding without content-length, and so NGINX  
> croaks at this same point.
> 
> Any help will be appreciated.

You should wait until Igor will implement support for input filters.

> Regards,  
> Mansoor

Manlio P.

---

<div class="post-metadata">

**Author:** ![Manlio\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6f9a4e/32.png) [@Manlio\_P](https://www.ruby-forum.com/u/Manlio_P)\
**Post date:** [April 6, 2009, 11:46am UTC](https://www.ruby-forum.com/t/add-support-for-chunked-input-encoding-in-nginx/133547/4 "2009-04-06T11:46:40Z")

</div>

Manlio P. wrote:

> Mansoor P. ha scritto:
> 
> > Hi Manlio
> > 
> > Were you able to find a work-around for this ?

A quick workaround:

> **[correcting Transfer-encoding:chunked problem in nginx](http://lisp-univ-etc.blogspot.com/2009/04/correcting-content-encodingchunked.html)**
>
> While Igor Sysoev is thinking on how to properly (i.e. robustly and efficiently) implement handling of Content-encoding:chunked with unset C...

Best regards,  
Vsevolod

---

<div class="post-metadata">

**Author:** ![Manlio\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6f9a4e/32.png) [@Manlio\_P](https://www.ruby-forum.com/u/Manlio_P)\
**Post date:** [April 9, 2009, 11:13am UTC](https://www.ruby-forum.com/t/add-support-for-chunked-input-encoding-in-nginx/133547/5 "2009-04-09T11:13:52Z")

</div>

Vsevolod Dyomkin wrote:

> Manlio P. wrote:
> 
> > Mansoor P. ha scritto:
> > 
> > > Hi Manlio
> > > 
> > > Were you able to find a work-around for this ?
> 
> A quick workaround:  
> [Lisp, the Universe and Everything: correcting Transfer-encoding:chunked problem in nginx](http://lisp-univ-etc.blogspot.com/2009/04/correcting-content-encodingchunked.html)
> 
> Best regards,  
> Vsevolod

An updated version:  
[https://www.blogger.com/comment.g?blogID=6031647961506005424&postID=3915986647933648395](https://www.blogger.com/comment.g?blogID=6031647961506005424&postID=3915986647933648395)
