changeset 620:b4dcae568a2a NGINX_1_0_0

nginx 1.0.0 *) Bugfix: a cache manager might hog CPU after reload. Thanks to Maxim Dounin. *) Bugfix: an "image_filter crop" directive worked incorrectly coupled with an "image_filter rotate 180" directive. *) Bugfix: a "satisfy any" directive disabled custom 401 error page.
author Igor Sysoev <http://sysoev.ru>
date Tue, 12 Apr 2011 00:00:00 +0400
parents c4e0de226b0b
children 00d13b6d4ebd
files CHANGES CHANGES.ru src/core/nginx.h src/core/ngx_conf_file.c src/core/ngx_string.h src/http/modules/ngx_http_auth_basic_module.c src/http/modules/ngx_http_geo_module.c src/http/modules/ngx_http_image_filter_module.c src/http/modules/ngx_http_ssi_filter_module.c src/http/modules/perl/nginx.pm src/http/ngx_http_core_module.c src/http/ngx_http_file_cache.c src/http/ngx_http_script.c
diffstat 13 files changed, 60 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES	Mon Apr 04 00:00:00 2011 +0400
+++ b/CHANGES	Tue Apr 12 00:00:00 2011 +0400
@@ -1,4 +1,15 @@
 
+Changes with nginx 1.0.0                                         12 Apr 2011
+
+    *) Bugfix: a cache manager might hog CPU after reload.
+       Thanks to Maxim Dounin.
+
+    *) Bugfix: an "image_filter crop" directive worked incorrectly coupled 
+       with an "image_filter rotate 180" directive.
+
+    *) Bugfix: a "satisfy any" directive disabled custom 401 error page.
+
+
 Changes with nginx 0.9.7                                         04 Apr 2011
 
     *) Feature: now keepalive connections may be closed premature, if there 
--- a/CHANGES.ru	Mon Apr 04 00:00:00 2011 +0400
+++ b/CHANGES.ru	Tue Apr 12 00:00:00 2011 +0400
@@ -1,4 +1,17 @@
 
+Изменения в nginx 1.0.0                                           12.04.2011
+
+    *) Исправление: cache manager мог нагружать процессор после 
+       переконфигурации.
+       Спасибо Максиму Дунину.
+
+    *) Исправление: директива "image_filter crop" неправильно работала в 
+       сочетании с "image_filter rotate 180".
+
+    *) Исправление: директива "satisfy any" запрещала выдачу 
+       пользовательской страницы для 401 кода.
+
+
 Изменения в nginx 0.9.7                                           04.04.2011
 
     *) Добавление: теперь соединения в состоянии keepalive могут быть 
--- a/src/core/nginx.h	Mon Apr 04 00:00:00 2011 +0400
+++ b/src/core/nginx.h	Tue Apr 12 00:00:00 2011 +0400
@@ -8,8 +8,8 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define nginx_version         9007
-#define NGINX_VERSION      "0.9.7"
+#define nginx_version      1000000
+#define NGINX_VERSION      "1.0.0"
 #define NGINX_VER          "nginx/" NGINX_VERSION
 
 #define NGINX_VAR          "NGINX"
--- a/src/core/ngx_conf_file.c	Mon Apr 04 00:00:00 2011 +0400
+++ b/src/core/ngx_conf_file.c	Tue Apr 12 00:00:00 2011 +0400
@@ -507,7 +507,7 @@
             }
 
             if (len) {
-                ngx_memcpy(b->start, start, len);
+                ngx_memmove(b->start, start, len);
             }
 
             size = (ssize_t) (file_size - cf->conf_file->file.offset);
--- a/src/core/ngx_string.h	Mon Apr 04 00:00:00 2011 +0400
+++ b/src/core/ngx_string.h	Tue Apr 12 00:00:00 2011 +0400
@@ -135,6 +135,10 @@
 #endif
 
 
+#define ngx_memmove(dst, src, n)   (void) memmove(dst, src, n)
+#define ngx_movemem(dst, src, n)   (((u_char *) memmove(dst, src, n)) + (n))
+
+
 /* msvc and icc7 compile memcmp() to the inline loop */
 #define ngx_memcmp(s1, s2, n)  memcmp((const char *) s1, (const char *) s2, n)
 
--- a/src/http/modules/ngx_http_auth_basic_module.c	Mon Apr 04 00:00:00 2011 +0400
+++ b/src/http/modules/ngx_http_auth_basic_module.c	Tue Apr 12 00:00:00 2011 +0400
@@ -248,7 +248,7 @@
 
         if (state == sw_passwd) {
             left = left + n - passwd;
-            ngx_memcpy(buf, &buf[passwd], left);
+            ngx_memmove(buf, &buf[passwd], left);
             passwd = 0;
 
         } else {
--- a/src/http/modules/ngx_http_geo_module.c	Mon Apr 04 00:00:00 2011 +0400
+++ b/src/http/modules/ngx_http_geo_module.c	Tue Apr 12 00:00:00 2011 +0400
@@ -685,7 +685,7 @@
 
                 range = a->elts;
 
-                ngx_memcpy(&range[i + 2], &range[i + 1],
+                ngx_memmove(&range[i + 2], &range[i + 1],
                            (a->nelts - 2 - i) * sizeof(ngx_http_geo_range_t));
 
                 range[i + 1].start = (u_short) s;
@@ -724,7 +724,7 @@
 
                 range = a->elts;
 
-                ngx_memcpy(&range[i + 3], &range[i + 1],
+                ngx_memmove(&range[i + 3], &range[i + 1],
                            (a->nelts - 3 - i) * sizeof(ngx_http_geo_range_t));
 
                 range[i + 2].start = (u_short) (e + 1);
@@ -752,7 +752,7 @@
 
                 range = a->elts;
 
-                ngx_memcpy(&range[i + 1], &range[i],
+                ngx_memmove(&range[i + 1], &range[i],
                            (a->nelts - 1 - i) * sizeof(ngx_http_geo_range_t));
 
                 range[i + 1].start = (u_short) (e + 1);
@@ -776,7 +776,7 @@
 
                 range = a->elts;
 
-                ngx_memcpy(&range[i + 2], &range[i + 1],
+                ngx_memmove(&range[i + 2], &range[i + 1],
                            (a->nelts - 2 - i) * sizeof(ngx_http_geo_range_t));
 
                 range[i + 1].start = (u_short) s;
@@ -861,7 +861,7 @@
             if (s == (ngx_uint_t) range[i].start
                 && e == (ngx_uint_t) range[i].end)
             {
-                ngx_memcpy(&range[i], &range[i + 1],
+                ngx_memmove(&range[i], &range[i + 1],
                            (a->nelts - 1 - i) * sizeof(ngx_http_geo_range_t));
 
                 a->nelts--;
--- a/src/http/modules/ngx_http_image_filter_module.c	Mon Apr 04 00:00:00 2011 +0400
+++ b/src/http/modules/ngx_http_image_filter_module.c	Tue Apr 12 00:00:00 2011 +0400
@@ -863,6 +863,10 @@
             }
             gdImageCopyRotated(dst, src, dy/2, dx/2, 0, 0, dx, dy, ctx->angle);
             gdImageDestroy(src);
+
+            t = dx;
+            dx = dy;
+            dy = t;
             break;
 
         case 180:
@@ -875,10 +879,6 @@
             gdImageDestroy(src);
             break;
         }
-
-        t = dx;
-        dx = dy;
-        dy = t;
     }
 
     if (conf->filter == NGX_HTTP_IMAGE_CROP) {
--- a/src/http/modules/ngx_http_ssi_filter_module.c	Mon Apr 04 00:00:00 2011 +0400
+++ b/src/http/modules/ngx_http_ssi_filter_module.c	Tue Apr 12 00:00:00 2011 +0400
@@ -1902,7 +1902,7 @@
 
     len = (uri->data + uri->len) - src;
     if (len) {
-        dst = ngx_copy(dst, src, len);
+        dst = ngx_movemem(dst, src, len);
     }
 
     uri->len = dst - uri->data;
--- a/src/http/modules/perl/nginx.pm	Mon Apr 04 00:00:00 2011 +0400
+++ b/src/http/modules/perl/nginx.pm	Tue Apr 12 00:00:00 2011 +0400
@@ -48,7 +48,7 @@
     HTTP_INSUFFICIENT_STORAGE
 );
 
-our $VERSION = '0.9.7';
+our $VERSION = '1.0.0';
 
 require XSLoader;
 XSLoader::load('nginx', $VERSION);
--- a/src/http/ngx_http_core_module.c	Mon Apr 04 00:00:00 2011 +0400
+++ b/src/http/ngx_http_core_module.c	Tue Apr 12 00:00:00 2011 +0400
@@ -1108,17 +1108,21 @@
 ngx_http_core_post_access_phase(ngx_http_request_t *r,
     ngx_http_phase_handler_t *ph)
 {
+    ngx_int_t  access_code;
+
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                    "post access phase: %ui", r->phase_handler);
 
-    if (r->access_code) {
-
-        if (r->access_code == NGX_HTTP_FORBIDDEN) {
+    access_code = r->access_code;
+
+    if (access_code) {
+        if (access_code == NGX_HTTP_FORBIDDEN) {
             ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
                           "access forbidden by rule");
         }
 
-        ngx_http_finalize_request(r, r->access_code);
+        r->access_code = 0;
+        ngx_http_finalize_request(r, access_code);
         return NGX_OK;
     }
 
@@ -1221,7 +1225,7 @@
             *e.pos = '\0';
 
             if (alias && ngx_strncmp(name, clcf->name.data, alias) == 0) {
-                ngx_memcpy(name, name + alias, len - alias);
+                ngx_memmove(name, name + alias, len - alias);
                 path.len -= alias;
             }
         }
--- a/src/http/ngx_http_file_cache.c	Mon Apr 04 00:00:00 2011 +0400
+++ b/src/http/ngx_http_file_cache.c	Tue Apr 12 00:00:00 2011 +0400
@@ -1027,6 +1027,7 @@
 
         if (fcn->count == 0) {
             ngx_http_file_cache_delete(cache, q, name);
+            wait = 0;
 
         } else {
             if (--tries) {
@@ -1191,7 +1192,7 @@
     ngx_http_file_cache_t  *cache = data;
 
     off_t   size;
-    time_t  next;
+    time_t  next, wait;
 
     next = ngx_http_file_cache_expire(cache);
 
@@ -1212,7 +1213,11 @@
             return next;
         }
 
-        next = ngx_http_file_cache_forced_expire(cache);
+        wait = ngx_http_file_cache_forced_expire(cache);
+
+        if (wait > 0) {
+            return wait;
+        }
 
         if (ngx_http_file_cache_manager_sleep(cache) != NGX_OK) {
             return next;
--- a/src/http/ngx_http_script.c	Mon Apr 04 00:00:00 2011 +0400
+++ b/src/http/ngx_http_script.c	Tue Apr 12 00:00:00 2011 +0400
@@ -1089,7 +1089,7 @@
                          NGX_UNESCAPE_REDIRECT);
 
         if (src < e->pos) {
-            dst = ngx_copy(dst, src, e->pos - src);
+            dst = ngx_movemem(dst, src, e->pos - src);
         }
 
         e->pos = dst;