'Content-Length' header for POSTs

agentzh agentzh at gmail.com
Fri Nov 6 12:00:08 MSK 2009


On Thu, Nov 5, 2009 at 9:56 AM, agentzh <agentzh at gmail.com> wrote:
>
> I've come up with this (naive) plan to add support for chunked request
> body without patching nginx:
>
>   location /foo {
>      echo_read_chunked_request_body;
>      echo_exec @foo;
>   }

Okay, I quickly realized that this approach won't fly after I actually
put my hands on it :) Nginx explicitly checks chunked
transfer-encoding headers and absent content length header in its very
early phase. Well, as early as the ngx_http_process_request_header
function. Sigh.

But no problem, thanks to chaoslawful++ for presenting another
approach to me. That is, using an output filter to intercept the 411
Length Required response issued by ngx_http_process_request_header,
fix things and issue an internal redirect to the current location,
thus starting from those phases we all know and love, this time
bypassing the horrible ngx_http_process_request_header function.

Now I'd like the chunked input feature to be in a separate module named chunkin:

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

It's still not fully working yet. I've just implemented and tested the
response rescue trick mentioned above. I'm about to implement the
chunked input reading handler already ;)

I'll keep you posted.

Stay tuned!
-agentzh





More information about the nginx mailing list