changeset 224:9909a161eb28 NGINX_0_3_59

nginx 0.3.59 *) Feature: now is possible to do several redirection using the "error_page" directive. *) Bugfix: the "dav_access" directive did not support three parameters. *) Bugfix: the "error_page" directive did not changes the "Content-Type" header line after the "X-Accel-Redirect" was used; bug appeared in 0.3.58.
author Igor Sysoev <http://sysoev.ru>
date Wed, 16 Aug 2006 00:00:00 +0400
parents c3b6f8ef140b
children d91e823fa629
files CHANGES CHANGES.ru auto/lib/md5/makefile.msvc auto/lib/sha1/makefile.msvc src/core/nginx.h src/http/modules/ngx_http_dav_module.c src/http/modules/ngx_http_memcached_module.c src/http/ngx_http.h src/http/ngx_http_core_module.c src/http/ngx_http_request.h src/http/ngx_http_special_response.c src/http/ngx_http_upstream.c src/http/ngx_http_upstream.h
diffstat 13 files changed, 47 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES	Mon Aug 14 00:00:00 2006 +0400
+++ b/CHANGES	Wed Aug 16 00:00:00 2006 +0400
@@ -1,4 +1,16 @@
 
+Changes with nginx 0.3.59                                        16 Aug 2006
+
+    *) Feature: now is possible to do several redirection using the 
+       "error_page" directive.
+
+    *) Bugfix: the "dav_access" directive did not support three parameters.
+
+    *) Bugfix: the "error_page" directive did not changes the 
+       "Content-Type" header line after the "X-Accel-Redirect" was used; 
+       bug appeared in 0.3.58.
+
+
 Changes with nginx 0.3.58                                        14 Aug 2006
 
     *) Feature: the "error_page" directive supports the variables.
--- a/CHANGES.ru	Mon Aug 14 00:00:00 2006 +0400
+++ b/CHANGES.ru	Wed Aug 16 00:00:00 2006 +0400
@@ -1,4 +1,16 @@
 
+Изменения в nginx 0.3.59                                          16.08.2006
+
+    *) Добавление: теперь можно делать несколько перенаправлений через 
+       директиву error_page.
+
+    *) Исправление: директива dav_access не поддерживала три параметра.
+
+    *) Исправление: директива error_page не изменяла строку "Content-Type" 
+       после перенаправления с помощью "X-Accel-Redirect"; ошибка появилась 
+       в 0.3.58.
+
+
 Изменения в nginx 0.3.58                                          14.08.2006
 
     *) Добавление: директива error_page поддерживает переменные.
--- a/auto/lib/md5/makefile.msvc	Mon Aug 14 00:00:00 2006 +0400
+++ b/auto/lib/md5/makefile.msvc	Wed Aug 16 00:00:00 2006 +0400
@@ -4,16 +4,16 @@
 
 CFLAGS = -nologo -O2 -Ob1 -Oi -Gs $(LIBC) $(CPU_OPT) -D L_ENDIAN
 
-!if "$(MD5_ASM)" == "YES"
+!IF "$(MD5_ASM)" == "YES"
 
 md5.lib:
 	cl -c $(CFLAGS) -D MD5_ASM md5_dgst.c
 	link -lib -out:md5.lib md5_dgst.obj asm/m-win32.obj
 
-!else
+!ELSE
 
 md5.lib:
 	cl -c $(CFLAGS) md5_dgst.c
 	link -lib -out:md5.lib md5_dgst.obj
 
-!endif
+!ENDIF
--- a/auto/lib/sha1/makefile.msvc	Mon Aug 14 00:00:00 2006 +0400
+++ b/auto/lib/sha1/makefile.msvc	Wed Aug 16 00:00:00 2006 +0400
@@ -4,16 +4,16 @@
 
 CFLAGS = -nologo -O2 -Ob1 -Oi -Gs $(LIBC) $(CPU_OPT) -D L_ENDIAN
 
-!if "$(SHA1_ASM)" == "YES"
+!IF "$(SHA1_ASM)" == "YES"
 
 sha1.lib:
 	cl -c $(CFLAGS) -D SHA1_ASM sha1dgst.c
 	link -lib -out:sha1.lib sha1dgst.obj asm/s-win32.obj
 
-!else
+!ELSE
 
 sha1.lib:
 	cl -c $(CFLAGS) sha1dgst.c
 	link -lib -out:sha1.lib sha1dgst.obj
 
-!endif
+!ENDIF
--- a/src/core/nginx.h	Mon Aug 14 00:00:00 2006 +0400
+++ b/src/core/nginx.h	Wed Aug 16 00:00:00 2006 +0400
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VER          "nginx/0.3.58"
+#define NGINX_VER          "nginx/0.3.59"
 
 #define NGINX_VAR          "NGINX"
 #define NGX_OLDPID_EXT     ".oldbin"
--- a/src/http/modules/ngx_http_dav_module.c	Mon Aug 14 00:00:00 2006 +0400
+++ b/src/http/modules/ngx_http_dav_module.c	Wed Aug 16 00:00:00 2006 +0400
@@ -57,7 +57,7 @@
       NULL },
 
     { ngx_string("dav_access"),
-      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE12,
+      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE123,
       ngx_http_dav_access,
       NGX_HTTP_LOC_CONF_OFFSET,
       0,
--- a/src/http/modules/ngx_http_memcached_module.c	Mon Aug 14 00:00:00 2006 +0400
+++ b/src/http/modules/ngx_http_memcached_module.c	Wed Aug 16 00:00:00 2006 +0400
@@ -526,7 +526,7 @@
     conf->upstream.max_temp_file_size = 0;
     conf->upstream.temp_file_write_size = 0;
     conf->upstream.intercept_errors = 1;
-    conf->upstream.redirect_404 = 1;
+    conf->upstream.intercept_404 = 1;
     conf->upstream.pass_request_headers = 0;
     conf->upstream.pass_request_body = 0;
 
--- a/src/http/ngx_http.h	Mon Aug 14 00:00:00 2006 +0400
+++ b/src/http/ngx_http.h	Wed Aug 16 00:00:00 2006 +0400
@@ -53,12 +53,8 @@
 };
 
 
-#define ngx_http_get_module_ctx(r, module)     (r)->ctx[module.ctx_index]
-#define ngx_http_get_module_err_ctx(r, module)                                \
-    ((r)->err_ctx ? (r)->err_ctx[module.ctx_index] : (r)->ctx[module.ctx_index])
-
-#define ngx_http_set_ctx(r, c, module)         r->ctx[module.ctx_index] = c;
-#define ngx_http_delete_ctx(r, module)         r->ctx[module.ctx_index] = NULL;
+#define ngx_http_get_module_ctx(r, module)  (r)->ctx[module.ctx_index]
+#define ngx_http_set_ctx(r, c, module)      r->ctx[module.ctx_index] = c;
 
 
 void ngx_http_init_connection(ngx_connection_t *c);
--- a/src/http/ngx_http_core_module.c	Mon Aug 14 00:00:00 2006 +0400
+++ b/src/http/ngx_http_core_module.c	Wed Aug 16 00:00:00 2006 +0400
@@ -464,7 +464,7 @@
 
     r->connection->unexpected_eof = 0;
 
-    if (r->err_ctx == NULL) {
+    if (!r->internal) {
         switch (r->headers_in.connection_type) {
         case 0:
             if (r->http_version > NGX_HTTP_VERSION_10) {
@@ -1341,21 +1341,8 @@
         return NGX_HTTP_INTERNAL_SERVER_ERROR;
     }
 
-    if (r->err_ctx) {
-
-        /* allocate the new module's contexts */
-
-        r->ctx = ngx_pcalloc(r->pool, sizeof(void *) * ngx_http_max_module);
-        if (r->ctx == NULL) {
-            return NGX_HTTP_INTERNAL_SERVER_ERROR;
-        }
-
-    } else {
-
-        /* clear the modules contexts */
-
-        ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module);
-    }
+    /* clear the modules contexts */
+    ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module);
 
     cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
     r->loc_conf = cscf->ctx->loc_conf;
--- a/src/http/ngx_http_request.h	Mon Aug 14 00:00:00 2006 +0400
+++ b/src/http/ngx_http_request.h	Wed Aug 16 00:00:00 2006 +0400
@@ -368,7 +368,6 @@
 
     off_t                             request_length;
 
-    void                            **err_ctx;
     ngx_uint_t                        err_status;
 
     ngx_http_connection_t            *http_connection;
--- a/src/http/ngx_http_special_response.c	Mon Aug 14 00:00:00 2006 +0400
+++ b/src/http/ngx_http_special_response.c	Wed Aug 16 00:00:00 2006 +0400
@@ -336,9 +336,11 @@
         }
     }
 
+    r->headers_out.content_type.len = 0;
+
     clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
 
-    if (r->err_ctx == NULL && clcf->error_pages) {
+    if (clcf->error_pages) {
 
         err_page = clcf->error_pages->elts;
 
@@ -346,7 +348,6 @@
 
             if (err_page[i].status == error) {
                 r->err_status = err_page[i].overwrite;
-                r->err_ctx = r->ctx;
 
                 r->method = NGX_HTTP_GET;
 
@@ -370,8 +371,9 @@
                                         ngx_list_push(&r->headers_out.headers);
 
                 if (r->headers_out.location) {
+                    error = NGX_HTTP_MOVED_TEMPORARILY;
+
                     r->err_status = NGX_HTTP_MOVED_TEMPORARILY;
-                    error = NGX_HTTP_MOVED_TEMPORARILY;
 
                     r->headers_out.location->hash = 1;
                     r->headers_out.location->key.len = sizeof("Location") - 1;
--- a/src/http/ngx_http_upstream.c	Mon Aug 14 00:00:00 2006 +0400
+++ b/src/http/ngx_http_upstream.c	Wed Aug 16 00:00:00 2006 +0400
@@ -1093,17 +1093,15 @@
             return;
         }
 
-        if (u->conf->redirect_404) {
-            rc = (r->err_ctx == NULL) ? 404 : 204;
-            ngx_http_upstream_finalize_request(r, u, rc);
+        if (u->conf->intercept_404) {
+            ngx_http_upstream_finalize_request(r, u, NGX_HTTP_NOT_FOUND);
             return;
         }
     }
 
 
     if (u->headers_in.status_n >= NGX_HTTP_BAD_REQUEST
-        && u->conf->intercept_errors
-        && r->err_ctx == NULL)
+        && u->conf->intercept_errors)
     {
         clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
 
--- a/src/http/ngx_http_upstream.h	Mon Aug 14 00:00:00 2006 +0400
+++ b/src/http/ngx_http_upstream.h	Wed Aug 16 00:00:00 2006 +0400
@@ -103,7 +103,7 @@
     ngx_str_t                       location;
     ngx_str_t                       url;  /* used in proxy_rewrite_location */
 
-    unsigned                        redirect_404:1;
+    unsigned                        intercept_404:1;
     unsigned                        change_buffering:1;
 
 #if (NGX_HTTP_SSL)