Welcome! Log In Create A New Profile

Advanced

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

agentzh
November 16, 2009 10:34PM
On Mon, Nov 16, 2009 at 7:48 PM, wangkai <nginx-forum@nginx.us> wrote:
> Hi, agentzh
>
> You are so awesome for the "thunkin" module implementation of ngix.

Well, I'm assuming you're serious. It's "chunkin" not "thunkin" :)

> I am a beginner for ngix and linux.
> I don't know how to do a little for your "thunkin" module.
>

To show how this module works in action, I'd use the "echo" module to
demonstrate the actual effect.

With both "echo" and "chunkin" modules compiled into your nginx, you
can try the following configuration:

chunkin on;
location /body {
echo_read_request_body; # try to read the request body
echo_request_body; # emit the request body
echo; # print out a
trailing new line
}

Then from your command line:

$ curl -d 'hello, world' -H 'Transfer-Encoding: chunked'
'http://localhost/body'
hello, world

$ curl -d 'hello, world' 'http://localhost/body'
hello, world

The first "curl" command enforces the "chunked" encoding to be used in
the HTTP request.

Then try turning off the "chunkin" directive:

chunkin off; # turn off this module
location /body {
echo_read_request_body; # try to read the request body
echo_request_body; # emit the request body
echo; # print out a
trailing new line
}

And try to send the previous requests again:

$ curl -d 'hello, world' -H 'Transfer-Encoding: chunked'
'http://localhost/body'
<html>
<head><title>411 Length Required</title></head>
<body bgcolor="white">
<center><h1>411 Length Required</h1></center>
<hr><center>nginx/0.8.24</center>
</body>
</html>

$ curl -d 'hello, world' 'http://localhost/body'
hello, world

The first response just shows the fact that nginx does not support the
"chunked" encoding itself while the second just tests the normal
transfer encoding :)

Note that the "chunkin" module does not rely on "echo" to function. I
just used "echo" for the sake of easy demonstration. FWIW, I also
makes heavy use of the "echo" module in the test suite of the
"chunkin" module, for example,

http://github.com/agentzh/chunkin-nginx-module/blob/master/test/t/sanity.t

I'd add this demo to the "chunkin" module's wiki page later:

http://wiki.nginx.org/NginxHttpChunkinModule

Please consult the "echo" module's wiki page for more detailed
explanation for the directives used above:

http://wiki.nginx.org/NginxHttpEchoModule

Cheers,
-agentzh
Subject Author Posted

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

agentzh November 15, 2009 05:34AM

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

wangkai November 16, 2009 06:48AM

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

Dinh Pham November 16, 2009 09:32PM

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

agentzh November 16, 2009 10:34PM

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

agentzh November 16, 2009 10:34PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 193
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready