diff options
author | Igor Sysoev <igor@sysoev.ru> | 2006-08-18 14:17:54 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2006-08-18 14:17:54 +0000 |
commit | 5fede1e415ae97ee9221d60a1208d47bdaaae34d (patch) | |
tree | 22d4b4d8948e68926e1699b54b4d1bc325bfb0ec /src/http/ngx_http_core_module.c | |
parent | 51c53f9bf16804c9d8c9c55c45dc05ffeadda4b8 (diff) | |
download | nginx-5fede1e415ae97ee9221d60a1208d47bdaaae34d.tar.gz nginx-5fede1e415ae97ee9221d60a1208d47bdaaae34d.zip |
nginx-0.3.60-RELEASE importrelease-0.3.60
*) Bugfix: a worker process may got caught in an endless loop while an
error redirection; the bug had appeared in 0.3.59.
Diffstat (limited to 'src/http/ngx_http_core_module.c')
-rw-r--r-- | src/http/ngx_http_core_module.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index b28931757..5c19167a9 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -507,7 +507,7 @@ ngx_http_handler(ngx_http_request_t *r) r->valid_location = 1; r->uri_changed = 1; - r->phase = (r == r->main) ? NGX_HTTP_POST_READ_PHASE: + r->phase = (!r->internal) ? NGX_HTTP_POST_READ_PHASE: NGX_HTTP_SERVER_REWRITE_PHASE; r->phase_handler = 0; @@ -1324,6 +1324,15 @@ ngx_http_internal_redirect(ngx_http_request_t *r, { ngx_http_core_srv_conf_t *cscf; + r->uri_changes--; + + if (r->uri_changes == 0) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "rewrite or internal redirection cycle"); + ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); + return NGX_DONE; + } + r->uri = *uri; if (args) { @@ -1338,7 +1347,8 @@ ngx_http_internal_redirect(ngx_http_request_t *r, "internal redirect: \"%V?%V\"", uri, &r->args); if (ngx_http_set_exten(r) != NGX_OK) { - return NGX_HTTP_INTERNAL_SERVER_ERROR; + ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); + return NGX_DONE; } /* clear the modules contexts */ @@ -1351,8 +1361,6 @@ ngx_http_internal_redirect(ngx_http_request_t *r, r->internal = 1; - r->uri_changes--; - ngx_http_handler(r); return NGX_DONE; |