Help! log phase is not executed due to r->count being non-zero

Maxim Dounin mdounin at
Mon Oct 13 19:09:23 UTC 2014


On Mon, Oct 13, 2014 at 02:43:07PM -0400, wangweixun wrote:

> Thanks for your prompt reply.
> Why do I have to do the work in the post handler? Now I have a stub post
> handler. ngx_http_read_client_request_body() does nothing but load the
> request body into the original request, which is used by the next handler.
> Everything seems to be working fine to me.

If you don't need a request body in your module, it's not clear 
why at all you are trying to read it.  If, in contrast, you do 
need the request body, you shouldn't try to do the real work till 
the post_handler is called.

Technically, you can use multiple access-phase handlers to handle 
things, as long as proper order is maintained by using flags set 
in post_handler.  But there is no need to use multiple handlers to 
do this, as there is no real difference as long as you anyway 
maintain flags set in post_handler.  On the other hand, if you 
indeed using a stub post_handler, it means that things are working 
by chance.

Maxim Dounin

More information about the nginx mailing list