changeset 388:6de24473fa70 NGINX_0_7_6

nginx 0.7.6 *) Bugfix: now if variables are used in the "access_log" directive a request root existence is always tested. *) Bugfix: the ngx_http_flv_module did not support several values in a query string.
author Igor Sysoev <http://sysoev.ru>
date Mon, 07 Jul 2008 00:00:00 +0400
parents 4cde8b18f2c9
children 930e48a26dde
files CHANGES CHANGES.ru src/core/nginx.h src/http/modules/ngx_http_flv_module.c src/http/modules/ngx_http_gzip_static_module.c src/http/modules/ngx_http_log_module.c src/http/modules/ngx_http_static_module.c src/http/modules/perl/nginx.pm src/http/ngx_http_core_module.c src/http/ngx_http_request.h
diffstat 10 files changed, 61 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES
+++ b/CHANGES
@@ -1,8 +1,17 @@
 
+Changes with nginx 0.7.6                                         07 Jul 2008
+
+    *) Bugfix: now if variables are used in the "access_log" directive a 
+       request root existence is always tested.
+
+    *) Bugfix: the ngx_http_flv_module did not support several values in a 
+       query string.
+
+
 Changes with nginx 0.7.5                                         01 Jul 2008
 
-    *) Bugfixes in variables support in the "access_log" directive; the bug 
-       had appeared in 0.7.4.
+    *) Bugfixes in variables support in the "access_log" directive; the 
+       bugs had appeared in 0.7.4.
 
     *) Bugfix: nginx could not be built --without-http_gzip_module; the bug 
        had appeared in 0.7.3.
--- a/CHANGES.ru
+++ b/CHANGES.ru
@@ -1,7 +1,16 @@
 
+Изменения в nginx 0.7.6                                           07.07.2008
+
+    *) Исправление: теперь при использовании переменных в директиве 
+       access_log всегда проверяется существовании root'а для запроса.
+
+    *) Исправление: модуль ngx_http_flv_module не поддерживал несколько 
+       значений в аргументах запроса.
+
+
 Изменения в nginx 0.7.5                                           01.07.2008
 
-    *) Исправления в поддержке переменных в директиве access_log; ошибка 
+    *) Исправления в поддержке переменных в директиве access_log; ошибки 
        появилась в 0.7.4.
 
     *) Исправление: nginx не собирался с параметром 
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VERSION      "0.7.5"
+#define NGINX_VERSION      "0.7.6"
 #define NGINX_VER          "nginx/" NGINX_VERSION
 
 #define NGINX_VAR          "NGINX"
--- a/src/http/modules/ngx_http_flv_module.c
+++ b/src/http/modules/ngx_http_flv_module.c
@@ -60,7 +60,7 @@ ngx_module_t  ngx_http_flv_module = {
 static ngx_int_t
 ngx_http_flv_handler(ngx_http_request_t *r)
 {
-    u_char                    *p, *last;
+    u_char                    *p, *n, *last;
     off_t                      start, len;
     size_t                     root;
     ngx_int_t                  rc;
@@ -159,6 +159,8 @@ ngx_http_flv_handler(ngx_http_request_t 
         return NGX_DECLINED;
     }
 
+    r->root_tested = 1;
+
     start = 0;
     len = of.size;
     i = 1;
@@ -169,7 +171,13 @@ ngx_http_flv_handler(ngx_http_request_t 
         if (p) {
             p += 6;
 
-            start = ngx_atoof(p, r->args.len - (p - r->args.data));
+            for (n = p; n < r->args.data + r->args.len; n++) {
+                if (*n == '&') {
+                    break;
+                }
+            }
+
+            start = ngx_atoof(p, n - p);
 
             if (start == NGX_ERROR || start >= len) {
                 start = 0;
--- a/src/http/modules/ngx_http_gzip_static_module.c
+++ b/src/http/modules/ngx_http_gzip_static_module.c
@@ -175,6 +175,8 @@ ngx_http_gzip_static_handler(ngx_http_re
 
 #endif
 
+    r->root_tested = 1;
+
     rc = ngx_http_discard_request_body(r);
 
     if (rc != NGX_OK) {
--- a/src/http/modules/ngx_http_log_module.c
+++ b/src/http/modules/ngx_http_log_module.c
@@ -366,7 +366,7 @@ ngx_http_log_script_write(ngx_http_reque
     ngx_http_log_loc_conf_t   *llcf;
     ngx_http_core_loc_conf_t  *clcf;
 
-    if (r->err_status == NGX_HTTP_NOT_FOUND) {
+    if (!r->root_tested) {
 
         /* test root directory existance */
 
@@ -387,10 +387,25 @@ ngx_http_log_script_write(ngx_http_reque
         of.events = clcf->open_file_cache_events;
 
         if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
-                != NGX_OK
-            || !of.is_dir)
+            != NGX_OK)
         {
-            /* no root directory: simulate successfull logging */
+            if (of.err == 0) {
+                /* simulate successfull logging */
+                return len;
+            }
+
+            ngx_log_error(NGX_LOG_ERR, r->connection->log, of.err,
+                          "testing \"%s\" existence failed", path.data);
+
+            /* simulate successfull logging */
+            return len;
+        }
+
+        if (!of.is_dir) {
+            ngx_log_error(NGX_LOG_ERR, r->connection->log, NGX_ENOTDIR,
+                          "testing \"%s\" existence failed", path.data);
+
+            /* simulate successfull logging */
             return len;
         }
     }
--- a/src/http/modules/ngx_http_static_module.c
+++ b/src/http/modules/ngx_http_static_module.c
@@ -140,6 +140,8 @@ ngx_http_static_handler(ngx_http_request
         return rc;
     }
 
+    r->root_tested = 1;
+
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "http static fd: %d", of.fd);
 
     if (of.is_dir) {
--- 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.7.5';
+our $VERSION = '0.7.6';
 
 require XSLoader;
 XSLoader::load('nginx', $VERSION);
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -3499,7 +3499,7 @@ ngx_http_core_open_file_cache(ngx_conf_t
 
             max = ngx_atoi(value[i].data + 4, value[i].len - 4);
             if (max == NGX_ERROR) {
-                return NGX_CONF_ERROR;
+                goto failed;
             }
 
             continue;
@@ -3512,7 +3512,7 @@ ngx_http_core_open_file_cache(ngx_conf_t
 
             inactive = ngx_parse_time(&s, 1);
             if (inactive < 0) {
-                return NGX_CONF_ERROR;
+                goto failed;
             }
 
             continue;
@@ -3525,6 +3525,8 @@ ngx_http_core_open_file_cache(ngx_conf_t
             continue;
         }
 
+    failed:
+
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
                            "invalid \"open_file_cache\" parameter \"%V\"",
                            &value[i]);
--- a/src/http/ngx_http_request.h
+++ b/src/http/ngx_http_request.h
@@ -469,6 +469,7 @@ struct ngx_http_request_s {
     unsigned                          request_output:1;
     unsigned                          header_sent:1;
     unsigned                          expect_tested:1;
+    unsigned                          root_tested:1;
     unsigned                          done:1;
     unsigned                          utf8:1;