]> git.kaiwu.me - nginx.git/commitdiff
nginx-0.3.60-RELEASE import release-0.3.60
authorIgor Sysoev <igor@sysoev.ru>
Fri, 18 Aug 2006 14:17:54 +0000 (14:17 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Fri, 18 Aug 2006 14:17:54 +0000 (14:17 +0000)
    *) Bugfix: a worker process may got caught in an endless loop while an
       error redirection; the bug had appeared in 0.3.59.

docs/xml/nginx/changes.xml
src/core/nginx.h
src/http/ngx_http_core_module.c
src/http/ngx_http_special_response.c

index a2107508cae81b6395dab592db3b67952bebf0bb..d2b79219127ba129379241e84a3e6c3203259df9 100644 (file)
@@ -9,6 +9,23 @@
 <title lang="en">nginx changelog</title>
 
 
+<changes ver="0.3.60" date="18.08.2006">
+
+<change type="bugfix">
+<para lang="ru">
+×Ï ×ÒÅÍÑ ÐÅÒÅÎÁÐÒÁ×ÌÅÎÉÑ ÏÛÉÂËÉ ÒÁÂÏÞÉÊ ÐÒÏÃÅÓÓ ÍÏÇ ÚÁÃÉËÌÉÔØÓÑ;
+ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.3.59.
+</para>
+<para lang="en">
+a worker process may got caught in an endless loop
+while an error redirection;
+bug appeared in 0.3.59.
+</para>
+</change>
+
+</changes>
+
+
 <changes ver="0.3.59" date="16.08.2006">
 
 <change type="feature">
index 224fb70f86c048d6ec94bbcd94e9b7833930e794..1d417fed817c53d5a07eb3da4a855d7c7791fda5 100644 (file)
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VER          "nginx/0.3.59"
+#define NGINX_VER          "nginx/0.3.60"
 
 #define NGINX_VAR          "NGINX"
 #define NGX_OLDPID_EXT     ".oldbin"
index b289317573a345f4bb5ca5adbbb21c20a0857b77..5c19167a91212d5d84bbb78bee118284d84b8556 100644 (file)
@@ -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;
index abdf62482678bc774b9451db8fa59cd8d882822e..a44c51c6a3e63d30abda9955c948ee2a7bdf745e 100644 (file)
@@ -312,6 +312,7 @@ ngx_http_special_response_handler(ngx_http_request_t *r, ngx_int_t error)
     }
 
     r->headers_out.status = error;
+    r->err_status = error;
 
     if (r->keepalive != 0) {
         switch (error) {
@@ -340,7 +341,7 @@ ngx_http_special_response_handler(ngx_http_request_t *r, ngx_int_t error)
 
     clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
 
-    if (clcf->error_pages) {
+    if (r->uri_changes && clcf->error_pages) {
 
         err_page = clcf->error_pages->elts;