Welcome! Log In Create A New Profile

Advanced

ngx_http_request_t's subrequests is what meaning be?

BoBo
July 01, 2010 08:16AM
hi all.

I am reading nginx's source(version is 0.7.66), but i don't understand this
section:

ngx_int_t
ngx_http_subrequest(ngx_http_request_t *r,
ngx_str_t *uri, ngx_str_t *args, ngx_http_request_t **psr,
ngx_http_post_subrequest_t *ps, ngx_uint_t flags)
{
ngx_connection_t *c;
ngx_http_request_t *sr;
ngx_http_core_srv_conf_t *cscf;
ngx_http_postponed_request_t *pr, *p;

//i know subrequests's default is NGX_HTTP_MAX_SUBREQUESTS + 1 = 51;
r->main->subrequests--;

//when subrequests is 0?
if (r->main->subrequests == 0) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"subrequests cycle while processing \"%V\"", uri);
r->main->subrequests = 1;
return NGX_ERROR;
}
.....................................................................

//why subrequests need plus plus?
r->main->subrequests++;

*psr = sr;

return ngx_http_post_request(sr);
}

the problem is after call ngx_http_subrequest and r->main->subrequests will
not change(because subrequests-- and then ++), so when subrequests is 0?

I think if r->main->subrequests is the max subrequests number,
r->main->subrequests++
need to be removed.

thanks.
--
博观约取

douban :www.douban.com/people/mustang/

blog: simohayha.javaeye.com

twitter: www.twitter.com/minibobo
_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

ngx_http_request_t's subrequests is what meaning be?

BoBo July 01, 2010 08:16AM

Re: ngx_http_request_t's subrequests is what meaning be?

BoBo July 01, 2010 08:38AM

Re: ngx_http_request_t's subrequests is what meaning be?

Maxim Dounin July 01, 2010 10:18AM

Re: ngx_http_request_t's subrequests is what meaning be?

BoBo July 01, 2010 11:08PM

Re: ngx_http_request_t's subrequests is what meaning be?

Maxim Dounin July 02, 2010 04:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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