]> git.kaiwu.me - nginx.git/commitdiff
Limit recursive subrequests instead of simultaneous.
authorValentin Bartenev <vbart@nginx.com>
Sun, 23 Aug 2015 18:03:32 +0000 (21:03 +0300)
committerValentin Bartenev <vbart@nginx.com>
Sun, 23 Aug 2015 18:03:32 +0000 (21:03 +0300)
src/http/ngx_http_core_module.c
src/http/ngx_http_request.c

index 22400cafa7942b4cfa8116c11703a02d073ae317..24627308e089d53ec19a984eec9c2631196bfeb5 100644 (file)
@@ -2427,12 +2427,9 @@ ngx_http_subrequest(ngx_http_request_t *r,
     ngx_http_core_srv_conf_t      *cscf;
     ngx_http_postponed_request_t  *pr, *p;
 
-    r->main->subrequests--;
-
-    if (r->main->subrequests == 0) {
+    if (r->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;
     }
 
@@ -2537,6 +2534,7 @@ ngx_http_subrequest(ngx_http_request_t *r,
     sr->main_filter_need_in_memory = r->main_filter_need_in_memory;
 
     sr->uri_changes = NGX_HTTP_MAX_URI_CHANGES + 1;
+    sr->subrequests = r->subrequests - 1;
 
     tp = ngx_timeofday();
     sr->start_sec = tp->sec;
index cd5f3023028fc2f4dc30c0d3de47abdf7fafc745..f0a203339930d2884e721800c35e9e0c9b9c7d42 100644 (file)
@@ -2338,7 +2338,6 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
         if (r == c->data) {
 
             r->main->count--;
-            r->main->subrequests++;
 
             if (!r->logged) {