changeset 210:14050d2bec9b NGINX_0_3_52

nginx 0.3.52 *) Change: the ngx_http_index_module behavior for the "POST /" requests is reverted to the 0.3.40 version state: the module now does not return the 405 error. *) Bugfix: the worker process may got caught in an endless loop if the limit rate was used; bug appeared in 0.3.37. *) Bugfix: ngx_http_charset_module logged "unknown charset" alert, even if the recoding was not needed; bug appeared in 0.3.50. *) Bugfix: if a code response of the PUT request was 409, then a temporary file was not removed.
author Igor Sysoev <http://sysoev.ru>
date Mon, 03 Jul 2006 00:00:00 +0400
parents 10c6621dce28
children f04a54878110
files CHANGES CHANGES.ru src/core/nginx.h src/core/ngx_file.c src/http/modules/ngx_http_charset_filter_module.c src/http/modules/ngx_http_dav_module.c src/http/modules/ngx_http_index_module.c src/http/ngx_http_write_filter_module.c
diffstat 8 files changed, 86 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES	Fri Jun 30 00:00:00 2006 +0400
+++ b/CHANGES	Mon Jul 03 00:00:00 2006 +0400
@@ -1,4 +1,20 @@
 
+Changes with nginx 0.3.52                                        03 Jul 2006
+
+    *) Change: the ngx_http_index_module behavior for the "POST /" requests 
+       is reverted to the 0.3.40 version state: the module now does not 
+       return the 405 error.
+
+    *) Bugfix: the worker process may got caught in an endless loop if the 
+       limit rate was used; bug appeared in 0.3.37.
+
+    *) Bugfix: ngx_http_charset_module logged "unknown charset" alert, even 
+       if the recoding was not needed; bug appeared in 0.3.50.
+
+    *) Bugfix: if a code response of the PUT request was 409, then a 
+       temporary file was not removed.
+
+
 Changes with nginx 0.3.51                                        30 Jun 2006
 
     *) Bugfix: the "<" symbols might disappeared some conditions in the 
--- a/CHANGES.ru	Fri Jun 30 00:00:00 2006 +0400
+++ b/CHANGES.ru	Mon Jul 03 00:00:00 2006 +0400
@@ -1,4 +1,21 @@
 
+Изменения в nginx 0.3.52                                          03.07.2006
+
+    *) Изменение: восстановлено поведение модуля ngx_http_index_module для 
+       запросов "POST /": как в версии до 0.3.40, модуль теперь не выдаёт 
+       ошибку 405.
+
+    *) Исправление: при использовании ограничения скорости рабочий процесс 
+       мог зациклиться; ошибка появилась в 0.3.37.
+
+    *) Исправление: модуль ngx_http_charset_module записывал в лог ошибку 
+       "unknown charset", даже если перекодировка не требовалась; ошибка 
+       появилась в 0.3.50.
+
+    *) Исправление: если в результате запроса PUT возвращался код 409, то 
+       временный файл не удалялся.
+
+
 Изменения в nginx 0.3.51                                          30.06.2006
 
     *) Исправление: при некоторых условиях в SSI мог пропадать символы "<"; 
--- a/src/core/nginx.h	Fri Jun 30 00:00:00 2006 +0400
+++ b/src/core/nginx.h	Mon Jul 03 00:00:00 2006 +0400
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VER          "nginx/0.3.51"
+#define NGINX_VER          "nginx/0.3.52"
 
 #define NGINX_VAR          "NGINX"
 #define NGX_OLDPID_EXT     ".oldbin"
--- a/src/core/ngx_file.c	Fri Jun 30 00:00:00 2006 +0400
+++ b/src/core/ngx_file.c	Mon Jul 03 00:00:00 2006 +0400
@@ -259,6 +259,10 @@
 
     path->name = value[1];
 
+    if (path->name.data[path->name.len - 1] == '/') {
+        path->name.len--;
+    }
+
     if (ngx_conf_full_name(cf->cycle, &path->name) == NGX_ERROR) {
         return NULL;
     }
--- a/src/http/modules/ngx_http_charset_filter_module.c	Fri Jun 30 00:00:00 2006 +0400
+++ b/src/http/modules/ngx_http_charset_filter_module.c	Mon Jul 03 00:00:00 2006 +0400
@@ -215,7 +215,7 @@
                                         r->headers_out.override_charset->data);
 
             if (charset == NGX_HTTP_NO_CHARSET) {
-                ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
+                ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
                               "unknown charset \"%V\" to override",
                               r->headers_out.override_charset);
 
@@ -269,18 +269,8 @@
 
             ctx->charset = charset;
 
-            if (charset == NGX_HTTP_NO_CHARSET) {
-                ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
-                              "unknown charset \"%V\" of main request", mc);
-
-                return ngx_http_next_header_filter(r);
-            }
-        }
-
-        charset = ctx->charset;
-
-        if (charset == NGX_HTTP_NO_CHARSET) {
-            return ngx_http_next_header_filter(r);
+        } else {
+            charset = ctx->charset;
         }
     }
 
@@ -289,16 +279,41 @@
     if (r->headers_out.charset.len == 0) {
         lcf = ngx_http_get_module_loc_conf(r, ngx_http_charset_filter_module);
 
-        return ngx_http_charset_set_charset(r, mcf->charsets.elts, charset,
-                                            lcf->source_charset);
+        if (charset != NGX_HTTP_NO_CHARSET) {
+            return ngx_http_charset_set_charset(r, mcf->charsets.elts, charset,
+                                                lcf->source_charset);
+        }
+
+        if (lcf->source_charset == NGX_CONF_UNSET) {
+            return ngx_http_next_header_filter(r);
+        }
+
+        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+                      "no \"charset_map\" between the charsets "
+                      "\"%V\" and \"%V\"",
+                      &charsets[lcf->source_charset].name,
+                      &r->main->headers_out.charset);
+
+        return ngx_http_next_header_filter(r);
     }
 
     source_charset = ngx_http_charset_get_charset(charsets, n,
                                                   r->headers_out.charset.data);
 
-    if (source_charset == NGX_HTTP_NO_CHARSET) {
-        ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
-                      "unknown source charset \"%V\"", &r->headers_out.charset);
+    if (charset == NGX_HTTP_NO_CHARSET
+        || source_charset == NGX_HTTP_NO_CHARSET)
+    {
+        if (charset != source_charset
+            || ngx_strcasecmp(r->main->headers_out.charset.data,
+                              r->headers_out.charset.data)
+                != 0)
+        {
+            ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+                          "no \"charset_map\" between the charsets "
+                          "\"%V\" and \"%V\"",
+                          &r->headers_out.charset,
+                          &r->main->headers_out.charset);
+        }
 
         return ngx_http_next_header_filter(r);
     }
@@ -307,7 +322,7 @@
         && (charsets[source_charset].tables == NULL
             || charsets[source_charset].tables[charset] == NULL))
     {
-        ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
+        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
                       "no \"charset_map\" between the charsets "
                       "\"%V\" and \"%V\"",
                       &charsets[source_charset].name, &charsets[charset].name);
--- a/src/http/modules/ngx_http_dav_module.c	Fri Jun 30 00:00:00 2006 +0400
+++ b/src/http/modules/ngx_http_dav_module.c	Mon Jul 03 00:00:00 2006 +0400
@@ -254,6 +254,12 @@
     }
 
     if (ngx_is_dir(&fi)) {
+        if (ngx_delete_file(temp->data) == NGX_FILE_ERROR) {
+            ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
+                          ngx_delete_file_n " \"%s\" failed",
+                          temp->data);
+        }
+
         ngx_http_finalize_request(r, NGX_HTTP_CONFLICT);
         return;
     }
@@ -296,6 +302,12 @@
 
 #endif
 
+    if (ngx_delete_file(temp->data) == NGX_FILE_ERROR) {
+        ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
+                      ngx_delete_file_n " \"%s\" failed",
+                      temp->data);
+    }
+
     ngx_http_finalize_request(r, ngx_http_dav_error(r, err, NGX_HTTP_CONFLICT,
                                                     ngx_rename_file_n,
                                                     path.data));
--- a/src/http/modules/ngx_http_index_module.c	Fri Jun 30 00:00:00 2006 +0400
+++ b/src/http/modules/ngx_http_index_module.c	Mon Jul 03 00:00:00 2006 +0400
@@ -143,10 +143,6 @@
         return NGX_DECLINED;
     }
 
-    if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {
-        return NGX_DECLINED;
-    }
-
     log = r->connection->log;
 
     /*
--- a/src/http/ngx_http_write_filter_module.c	Fri Jun 30 00:00:00 2006 +0400
+++ b/src/http/ngx_http_write_filter_module.c	Mon Jul 03 00:00:00 2006 +0400
@@ -215,7 +215,7 @@
         if (to_send <= 0) {
             c->write->delayed = 1;
             ngx_add_timer(r->connection->write,
-                       (ngx_msec_t) (- to_send * 1000 / r->limit_rate));
+                       (ngx_msec_t) (- to_send * 1000 / r->limit_rate + 1));
 
             c->buffered |= NGX_HTTP_WRITE_BUFFERED;
 
@@ -245,7 +245,7 @@
         sent = c->sent - sent;
         c->write->delayed = 1;
         ngx_add_timer(r->connection->write,
-                      (ngx_msec_t) (sent * 1000 / r->limit_rate));
+                      (ngx_msec_t) (sent * 1000 / r->limit_rate + 1));
     }
 
     for (cl = r->out; cl && cl != chain; /* void */) {