Welcome! Log In Create A New Profile

Advanced

The "chunkin" module: Experimental chunked input support for Nginx

agentzh
November 15, 2009 05:34AM
Hi, folks!

Pushed by those cutting-edge users on the list, I've quickly worked
out "chunkin" module which adds HTTP 1.1 chunked input support for
Nginx without the need to patching the core:

http://github.com/agentzh/chunkin-nginx-module

This module registers an access-phase handler that will eagerly read
and decode incoming request bodies when a "Transfer-Encoding: chunked"
header triggers a 411 error page in Nginx (hey, that's what you have
to pay for avoiding patching the core ;)). For requests that are not
in the "chunked" transfer encoding, this module is a "no-op".

To enable the magic, just turn on the "chunkin" config option like this:

chunkin on;
location /foo { ... }
....

No other modification is required in your nginx.conf file. (The
"chunkin" directive is not allowed to use in the location block BTW.)

This module is still considered highly experimental and there must be
some serious bugs lurking somewhere. But you're encouraged to play and
test it in your non-production environment and report any quirks to me
:)

Efforts have been made to reduce data copying, dynamic memory
allocation, and other performance tuning, thus unfortunately raising
the risk of potential buffer handling bugs caused by premature
optimizations :P

This module is not supposed to be merged into the Nginx core because
I've used Ragel to generate the chunked encoding parser for joy :)

The following Nginx versions have been successfully tested by this
module's (very limited) test suite:

0.8.0 ~ 0.8.24
0.7.21 ~ 0.7.63

The test suite definitely needs more test cases and the code is hacky
in various places. If you're willing to contribute, feel free to ask
me for a commit bit in a private email :)

Have fun!
-agentzh
SubjectAuthorPosted

The "chunkin" module: Experimental chunked input support for Nginx

agentzhNovember 15, 2009 05:34AM

Re: The "chunkin" module: Experimental chunked input support for Nginx

wangkaiNovember 16, 2009 06:48AM

Re: The "chunkin" module: Experimental chunked input support for Nginx

Dinh PhamNovember 16, 2009 09:32PM

Re: The "chunkin" module: Experimental chunked input support for Nginx

agentzhNovember 16, 2009 10:34PM

Re: The "chunkin" module: Experimental chunked input support for Nginx

agentzhNovember 16, 2009 10:34PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 86
Record Number of Users: 7 on March 06, 2014
Record Number of Guests: 229 on August 01, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready