Best Practice Behaviour of Body Handler

Alex Chamberlain alex at
Fri Jan 6 16:10:58 UTC 2012

Hi all,

I've started to develop a RESTful interface onto MongoDB as an Nginx
Module. I've started to work on PUT requests, and I'm just wondering about
a couple of things with the body handler.

My content handler registers the body handler
using ngx_http_read_client_request_body.

When this gets called, if everything goes correctly, I either want to send
204 No Content or 303 See Other. Therefore, no body. What should I be
calling ngx_http_finalize_request with? I'm currently passing zero-length
buffers, and I'm getting alerts, so it must be wrong...

On the other hand, if something goes wrong, I suspect I should still be
calling ngx_http_finalize_request, right? If so, what should the arguements
be then?

Thanks for your help. My code can be found at I'd be very interested on
any feedback, but please bear in mind I'm relatively inexperienced, so I
expect to make mistakes and really won't mind any friendly advice.

Alex Chamberlain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx-devel mailing list