# Implementing HTTP/1.1 request chunking

**URL:** <https://www.ruby-forum.com/t/implementing-http-1-1-request-chunking/181651>\
**Category:** NGINX\
**Created:** [January 15, 2010, 8:27am UTC](https://www.ruby-forum.com/t/implementing-http-1-1-request-chunking/181651 "2010-01-15T08:27:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dzo](https://www.ruby-forum.com/u/dzo)\
**Post date:** [January 15, 2010, 8:27am UTC](https://www.ruby-forum.com/t/implementing-http-1-1-request-chunking/181651/1 "2010-01-15T08:27:39Z")

</div>

Hi all,

I want to get some input with regards to having HTTP/1.1 request  
chunking in  
Nginx. I¹ve done some digging, and I¹ve found a few patches and the  
module  
developed by agentzh.

So, my question is this –  
What, as a developer, would I need to do so that I could create a patch  
for  
this that would be accepted as part of the Nginx distribution?

I know that some of the items on this list so far are:

1. That the patch works.
2. Error checking – check the size of the chunks & that the series of  
chunks are terminated properly.
3. Don’t use Ragel. 🙂 Or, for that matter, any tool not already in use  
by  
the Nginx build process.

Thank you -

Ian H. Greenhoe  
MANDIANT  
Senior Software Developer  
675 North Washington Street  
Suite 210  
Alexandria, VA 22314  
703.224.2905 t  
703.683.2891 f  
512.422.9564 m  
removed\_email\_address@domain.invalid

> **[Cyber Threat Defense Solutions | Threat Intelligence Services](https://www.mandiant.com/)**
>
> Mandiant Cyber Threat Defense Solutions leverage innovative technology and expertise from the frontlines to protect your organization against cyber attacks.

---

<div class="post-metadata">

**Author:** ![dzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dzo](https://www.ruby-forum.com/u/dzo)\
**Post date:** [January 15, 2010, 11:05am UTC](https://www.ruby-forum.com/t/implementing-http-1-1-request-chunking/181651/2 "2010-01-15T11:05:07Z")

</div>

On Fri, Jan 15, 2010 at 3:19 PM, Ian G.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> So, my question is this –  
> What, as a developer, would I need to do so that I could create a patch for  
> this that would be accepted as part of the Nginx distribution?

I started writing the ngx\_chunkin module just because it’s  
particularly hard (for me) to create a patch (of this size) that can  
be accepted by Igor S.. Patching the core would be much much  
easier than doing chunked reading from outside 🙂

> I know that some of the items on this list so far are:
> 
> 1. That the patch works.

ngx\_chunkin works 🙂 AFAIK, some people have already put it into  
production 🙂

> 1. Error checking – check the size of the chunks & that the series of  
> chunks are terminated properly.

ngx\_chunkin honors the http core module’s max\_client\_body\_size  
directive settings, as well as the client\_body\_buffer\_size and  
client\_body\_timeout settings.

> 1. Don’t use Ragel. 🙂 Or, for that matter, any tool not already in use by  
> the Nginx build process.

Okay, ngx\_chunkin uses Ragel just to eliminate a lot of boring code  
for truly streaming parsing. Fortunately we can generate C source  
before we make a release such that the end user don’t need to know  
anything about Ragel 🙂

I’m not meant to discourage your efforts. If your patch gets accepted  
by the core, I’d happily mark ngx\_chunkin as obsolete and just  
encourage people to use it if they have to stick with an earlier nginx  
version for some reasons.

Cheers,  
-agentzh

---

<div class="post-metadata">

**Author:** ![dzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dzo](https://www.ruby-forum.com/u/dzo)\
**Post date:** [January 15, 2010, 11:15am UTC](https://www.ruby-forum.com/t/implementing-http-1-1-request-chunking/181651/3 "2010-01-15T11:15:40Z")

</div>

On Fri, Jan 15, 2010 at 3:19 PM, Ian G.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I know that some of the items on this list so far are:

Oh, forgot to mention we should also take into account HTTP 1.1  
keepalive and pipelining support.

ngx\_chunkin currently has a working non-pipelined keepalive support,  
but the pipelining support is untested so far. (Even though POST +  
pipelining is rare in real world.)

Cheers,  
-agentzh

---

<div class="post-metadata">

**Author:** ![dzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dzo](https://www.ruby-forum.com/u/dzo)\
**Post date:** [January 15, 2010, 3:50pm UTC](https://www.ruby-forum.com/t/implementing-http-1-1-request-chunking/181651/4 "2010-01-15T15:50:13Z")

</div>

On 1/15/10 5:04 AM, “agentzh” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Fri, Jan 15, 2010 at 3:19 PM, Ian G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > So, my question is this –  
> > What, as a developer, would I need to do so that I could create a patch for  
> > this that would be accepted as part of the Nginx distribution?
> 
> I started writing the ngx\_chunkin module just because it’s  
> particularly hard (for me) to create a patch (of this size) that can  
> be accepted by Igor S.. Patching the core would be much much  
> easier than doing chunked reading from outside 🙂

Ooh, yeah. It would definitely be easier to patch the core… Which is  
why I  
was asking.

> > I know that some of the items on this list so far are:
> > 
> > 1. That the patch works.
> 
> ngx\_chunkin works 🙂 AFAIK, some people have already put it into production 🙂

Didn’t mean to imply that it didn’t – I’m just listing all of the  
requirements. 🙂

> > 1. Error checking – check the size of the chunks & that the series of  
> > chunks are terminated properly.
> 
> ngx\_chunkin honors the http core module’s max\_client\_body\_size  
> directive settings, as well as the client\_body\_buffer\_size and  
> client\_body\_timeout settings.

This is exactly the sort of thing that I need to know.

> > 1. Don’t use Ragel. 🙂 Or, for that matter, any tool not already in use by  
> > the Nginx build process.
> 
> Okay, ngx\_chunkin uses Ragel just to eliminate a lot of boring code  
> for truly streaming parsing. Fortunately we can generate C source  
> before we make a release such that the end user don’t need to know  
> anything about Ragel 🙂

I understand – I’ve both used parser generators and coded parsers by  
hand.  
Using parser generators is much preferred.

> I’m not meant to discourage your efforts. If your patch gets accepted  
> by the core, I’d happily mark ngx\_chunkin as obsolete and just  
> encourage people to use it if they have to stick with an earlier nginx  
> version for some reasons.

Here’s to hoping that I can obsolete your code. 🙂

-Ian
