changeset 548:ab7d265273ed NGINX_0_8_26

nginx 0.8.26 *) Bugfix: in captures usage in "rewrite" directive; the bug had appeared in 0.8.25. *) Bugfix: nginx could not be built without the --with-debug option; the bug had appeared in 0.8.25.
author Igor Sysoev <http://sysoev.ru>
date Mon, 16 Nov 2009 00:00:00 +0300
parents 43154840419e
children 04cfef16b736
files CHANGES CHANGES.ru src/core/nginx.h src/http/modules/perl/nginx.pm src/http/ngx_http_core_module.c src/http/ngx_http_script.c src/http/ngx_http_variables.c src/os/unix/ngx_alloc.c
diffstat 8 files changed, 34 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,13 @@
 
+Changes with nginx 0.8.26                                        16 Nov 2009
+
+    *) Bugfix: in captures usage in "rewrite" directive; the bug had 
+       appeared in 0.8.25.
+
+    *) Bugfix: nginx could not be built without the --with-debug option; 
+       the bug had appeared in 0.8.25.
+
+
 Changes with nginx 0.8.25                                        16 Nov 2009
 
     *) Change: now no message is written in an error log if a variable is 
--- a/CHANGES.ru
+++ b/CHANGES.ru
@@ -1,4 +1,13 @@
 
+Изменения в nginx 0.8.26                                          16.11.2009
+
+    *) Исправление: ошибки при использовании выделений в директиве rewrite; 
+       ошибка появилась в 0.8.25.
+
+    *) Исправление: nginx не собирался без параметра --with-debug; ошибка 
+       появилась в 0.8.25.
+
+
 Изменения в nginx 0.8.25                                          16.11.2009
 
     *) Изменение: теперь в лог ошибок не пишется сообщение, если переменная 
@@ -17,8 +26,8 @@
        недостатке памяти; ошибка появилась в 0.8.18.
 
     *) Исправление: nginx передавал сжатые ответы клиентам, не 
-       поддерживающим сжатие при настройках gzip_static on и gzip_vary off; 
-       ошибка появилась в 0.8.16.
+       поддерживающим сжатие, при настройках gzip_static on и gzip_vary 
+       off; ошибка появилась в 0.8.16.
 
 
 Изменения в nginx 0.8.24                                          11.11.2009
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,8 +8,8 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define nginx_version         8025
-#define NGINX_VERSION      "0.8.25"
+#define nginx_version         8026
+#define NGINX_VERSION      "0.8.26"
 #define NGINX_VER          "nginx/" NGINX_VERSION
 
 #define NGINX_VAR          "NGINX"
--- a/src/http/modules/perl/nginx.pm
+++ b/src/http/modules/perl/nginx.pm
@@ -47,7 +47,7 @@ our @EXPORT = qw(
     HTTP_INSUFFICIENT_STORAGE
 );
 
-our $VERSION = '0.8.25';
+our $VERSION = '0.8.26';
 
 require XSLoader;
 XSLoader::load('nginx', $VERSION);
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -2759,6 +2759,10 @@ ngx_http_core_init_main_conf(ngx_conf_t 
     cmcf->variables_hash_bucket_size =
                ngx_align(cmcf->variables_hash_bucket_size, ngx_cacheline_size);
 
+    if (cmcf->ncaptures) {
+        cmcf->ncaptures = (cmcf->ncaptures + 1) * 3;
+    }
+
     return NGX_CONF_OK;
 }
 
--- a/src/http/ngx_http_script.c
+++ b/src/http/ngx_http_script.c
@@ -910,14 +910,14 @@ ngx_http_script_regex_start_code(ngx_htt
         e->buf.len = code->size;
 
         if (code->uri) {
-            if (rc && (r->quoted_uri || r->plus_in_uri)) {
+            if (r->ncaptures && (r->quoted_uri || r->plus_in_uri)) {
                 e->buf.len += 2 * ngx_escape_uri(NULL, r->uri.data, r->uri.len,
                                                  NGX_ESCAPE_ARGS);
             }
         }
 
-        for (n = 1; n < (ngx_uint_t) rc; n++) {
-            e->buf.len += r->captures[2 * n + 1] - r->captures[2 * n];
+        for (n = 2; n < r->ncaptures; n += 2) {
+            e->buf.len += r->captures[n + 1] - r->captures[n];
         }
 
     } else {
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -1759,7 +1759,7 @@ ngx_http_regex_exec(ngx_http_request_t *
     cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
 
     if (re->ncaptures) {
-        len = (cmcf->ncaptures + 1) * 3;
+        len = cmcf->ncaptures;
 
         if (r->captures == NULL) {
             r->captures = ngx_palloc(r->pool, len * sizeof(int));
@@ -1810,7 +1810,7 @@ ngx_http_regex_exec(ngx_http_request_t *
 #endif
     }
 
-    r->ncaptures = len;
+    r->ncaptures = rc * 2;
     r->captures_data = s->data;
 
     return NGX_OK;
--- a/src/os/unix/ngx_alloc.c
+++ b/src/os/unix/ngx_alloc.c
@@ -61,7 +61,7 @@ ngx_memalign(size_t alignment, size_t si
         p = NULL;
     }
 
-    ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0,
+    ngx_log_debug3(NGX_LOG_DEBUG_ALLOC, log, 0,
                    "posix_memalign: %p:%uz @%uz", p, size, alignment);
 
     return p;
@@ -80,7 +80,7 @@ ngx_memalign(size_t alignment, size_t si
                       "memalign(%uz, %uz) failed", alignment, size);
     }
 
-    ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0,
+    ngx_log_debug3(NGX_LOG_DEBUG_ALLOC, log, 0,
                    "memalign: %p:%uz @%uz", p, size, alignment);
 
     return p;