changeset 661:9079ee4735ae release-0.3.52

nginx-0.3.52-RELEASE import *) 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; the bug had appeared in 0.3.37. *) Bugfix: ngx_http_charset_module logged "unknown charset" alert, even if the recoding was not needed; the bug had 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 <igor@sysoev.ru>
date Mon, 03 Jul 2006 16:49:20 +0000
parents f27e6b2abcba
children 4c15f63afe65
files docs/xml/nginx/changes.xml 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 7 files changed, 104 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/docs/xml/nginx/changes.xml
+++ b/docs/xml/nginx/changes.xml
@@ -9,6 +9,57 @@
 <title lang="en">nginx changelog</title>
 
 
+<changes ver="0.3.52" date="03.07.2006">
+
+<change type="change">
+<para lang="ru">
+восстановлено поведение модуля ngx_http_index_module для запросов "POST /":
+как в версии до 0.3.40, модуль теперь не выдаёт ошибку 405.
+</para>
+<para lang="en">
+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.
+</para>
+</change>
+
+<change type="bugfix">
+<para lang="ru">
+при использовании ограничения скорости рабочий процесс мог зациклиться;
+ошибка появилась в 0.3.37.
+</para>
+<para lang="en">
+the worker process may got caught in an endless loop if the limit rate was used;
+bug appeared in 0.3.37.
+</para>
+</change>
+
+<change type="bugfix">
+<para lang="ru">
+модуль ngx_http_charset_module записывал в лог ошибку "unknown charset",
+даже если перекодировка не требовалась;
+ошибка появилась в 0.3.50.
+</para>
+<para lang="en">
+ngx_http_charset_module logged "unknown charset" alert, even if the recoding
+was not needed;
+bug appeared in 0.3.50.
+</para>
+</change>
+
+<change type="bugfix">
+<para lang="ru">
+если в результате запроса PUT возвращался код 409, то временный файл
+не удалялся.
+</para>
+<para lang="en">
+if a code response of the PUT request was 409, then a temporary file
+was not removed.
+</para>
+</change>
+
+</changes>
+
+
 <changes ver="0.3.51" date="30.06.2006">
 
 <change type="bugfix">
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -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
+++ b/src/core/ngx_file.c
@@ -259,6 +259,10 @@ ngx_conf_set_path_slot(ngx_conf_t *cf, n
 
     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
+++ b/src/http/modules/ngx_http_charset_filter_module.c
@@ -215,7 +215,7 @@ ngx_http_charset_header_filter(ngx_http_
                                         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 @@ ngx_http_charset_header_filter(ngx_http_
 
             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 @@ ngx_http_charset_header_filter(ngx_http_
     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 @@ ngx_http_charset_header_filter(ngx_http_
         && (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
+++ b/src/http/modules/ngx_http_dav_module.c
@@ -254,6 +254,12 @@ ngx_http_dav_put_handler(ngx_http_reques
     }
 
     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 @@ ngx_http_dav_put_handler(ngx_http_reques
 
 #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
+++ b/src/http/modules/ngx_http_index_module.c
@@ -143,10 +143,6 @@ ngx_http_index_handler(ngx_http_request_
         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
+++ b/src/http/ngx_http_write_filter_module.c
@@ -215,7 +215,7 @@ ngx_http_write_filter(ngx_http_request_t
         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 @@ ngx_http_write_filter(ngx_http_request_t
         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 */) {