Maxim Dounin
October 13, 2014 06:06AM
Hello!

On Sat, Oct 11, 2014 at 12:28:08AM -0400, wangweixun wrote:

> Hey all,
>
> I'm writing an authentication module that is structurally very similar to
> ngx_http_auth_request_module
> (https://github.com/PiotrSikora/ngx_http_auth_request_module/blob/master/ngx_http_auth_request_module.c).
> It basically sends a subrequest to a service for auth. For testing, I put a
> hello_world module module
> (https://github.com/perusio/nginx-hello-world-module/blob/master/ngx_http_hello_world_module.c)
> behind it like:
>
> location /hello_world {
> auth_request /auth;
> hello_world;
> hello_world_string "Hello World!";
> }
>
> Everything works fine EXCEPT I found today that the log phase is not
> excuted. I traced it down to ngx_http_close_request function in
> ngx_http_request.c (as it calls ngx_http_free_request(r, rc); to excute log
> handlers) where I found r->count = 2 so after r->count--; it's still
> non-zero thus ngx_http_close_request simply returns. I did not touch request
> count in my code.
>
> Are we supposed to handle r->acount (either directly or through
> ngx_http_finalize_request) when using subrequest? I didn't see the original
> ngx_http_auth_request_module does so. If not, then why the request count is
> incorrect?

My best quess is that in your module you are calling
ngx_http_read_client_request_body(), which will increment r->count.

--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

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

wangweixun October 11, 2014 12:28AM

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

wangweixun October 11, 2014 12:30AM

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

Maxim Dounin October 13, 2014 06:06AM

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

wangweixun October 13, 2014 12:41PM

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

Maxim Dounin October 13, 2014 01:08PM

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

wangweixun October 13, 2014 02:43PM

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

Maxim Dounin October 13, 2014 03:10PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 257
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