changeset 672:f41d4b305d22 NGINX_1_2_0

nginx 1.2.0 *) Bugfix: a segmentation fault might occur in a worker process if the "try_files" directive was used; the bug had appeared in 1.1.19. *) Bugfix: response might be truncated if there were more than IOV_MAX buffers used. *) Bugfix: in the "crop" parameter of the "image_filter" directive. Thanks to Maxim Bublis.
author Igor Sysoev <http://sysoev.ru>
date Mon, 23 Apr 2012 00:00:00 +0400
parents 47cb3497fbab
children 1e5c7a976f48
files CHANGES CHANGES.ru src/core/nginx.c src/core/nginx.h src/core/ngx_conf_file.c src/core/ngx_string.c src/event/ngx_event.c src/http/modules/ngx_http_fastcgi_module.c src/http/modules/ngx_http_geo_module.c src/http/modules/ngx_http_image_filter_module.c src/http/modules/ngx_http_proxy_module.c src/http/modules/ngx_http_scgi_module.c src/http/modules/ngx_http_split_clients_module.c src/http/modules/ngx_http_ssi_filter_module.c src/http/modules/ngx_http_uwsgi_module.c src/http/modules/perl/nginx.pm src/http/ngx_http_core_module.c src/http/ngx_http_request.c src/http/ngx_http_request_body.c src/os/unix/ngx_darwin_sendfile_chain.c src/os/unix/ngx_freebsd_sendfile_chain.c src/os/unix/ngx_linux_sendfile_chain.c src/os/unix/ngx_readv_chain.c src/os/unix/ngx_solaris_sendfilev_chain.c src/os/unix/ngx_writev_chain.c
diffstat 25 files changed, 190 insertions(+), 103 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES	Thu Apr 12 00:00:00 2012 +0400
+++ b/CHANGES	Mon Apr 23 00:00:00 2012 +0400
@@ -1,4 +1,16 @@
 
+Changes with nginx 1.2.0                                         23 Apr 2012
+
+    *) Bugfix: a segmentation fault might occur in a worker process if the
+       "try_files" directive was used; the bug had appeared in 1.1.19.
+
+    *) Bugfix: response might be truncated if there were more than IOV_MAX
+       buffers used.
+
+    *) Bugfix: in the "crop" parameter of the "image_filter" directive.
+       Thanks to Maxim Bublis.
+
+
 Changes with nginx 1.1.19                                        12 Apr 2012
 
     *) Security: specially crafted mp4 file might allow to overwrite memory
--- a/CHANGES.ru	Thu Apr 12 00:00:00 2012 +0400
+++ b/CHANGES.ru	Mon Apr 23 00:00:00 2012 +0400
@@ -1,4 +1,16 @@
 
+Изменения в nginx 1.2.0                                           23.04.2012
+
+    *) Исправление: в рабочем процессе мог произойти segmentation fault,
+       если использовалась директива try_files; ошибка появилась в 1.1.19.
+
+    *) Исправление: ответ мог быть передан не полностью, если использовалось
+       больше IOV_MAX буферов.
+
+    *) Исправление: в работе параметра crop директивы image_filter.
+       Спасибо Maxim Bublis.
+
+
 Изменения в nginx 1.1.19                                          12.04.2012
 
     *) Безопасность: при обработке специально созданного mp4 файла модулем
--- a/src/core/nginx.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/core/nginx.c	Mon Apr 23 00:00:00 2012 +0400
@@ -649,7 +649,7 @@
         if (ngx_rename_file(ccf->oldpid.data, ccf->pid.data) != NGX_OK) {
             ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
                           ngx_rename_file_n " %s back to %s failed after "
-                          "the try to execute the new binary process \"%s\"",
+                          "an attempt to execute new binary process \"%s\"",
                           ccf->oldpid.data, ccf->pid.data, argv[0]);
         }
     }
--- a/src/core/nginx.h	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/core/nginx.h	Mon Apr 23 00:00:00 2012 +0400
@@ -9,8 +9,8 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define nginx_version      1001019
-#define NGINX_VERSION      "1.1.19"
+#define nginx_version      1002000
+#define NGINX_VERSION      "1.2.0"
 #define NGINX_VER          "nginx/" NGINX_VERSION
 
 #define NGINX_VAR          "NGINX"
--- a/src/core/ngx_conf_file.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/core/ngx_conf_file.c	Mon Apr 23 00:00:00 2012 +0400
@@ -465,7 +465,7 @@
 
             if (cf->conf_file->file.offset >= file_size) {
 
-                if (cf->args->nelts > 0) {
+                if (cf->args->nelts > 0 || !last_space) {
 
                     if (cf->conf_file->file.fd == NGX_INVALID_FILE) {
                         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
@@ -1481,7 +1481,8 @@
         }
 
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-                           "value must be equal or more than %i", bounds->low);
+                           "value must be equal to or greater than %i",
+                           bounds->low);
 
         return NGX_CONF_ERROR;
     }
--- a/src/core/ngx_string.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/core/ngx_string.c	Mon Apr 23 00:00:00 2012 +0400
@@ -146,12 +146,12 @@
 {
     u_char                *p, zero;
     int                    d;
-    double                 f, scale;
+    double                 f;
     size_t                 len, slen;
     int64_t                i64;
-    uint64_t               ui64;
+    uint64_t               ui64, frac;
     ngx_msec_t             ms;
-    ngx_uint_t             width, sign, hex, max_width, frac_width, n;
+    ngx_uint_t             width, sign, hex, max_width, frac_width, scale, n;
     ngx_str_t             *v;
     ngx_variable_value_t  *vv;
 
@@ -365,28 +365,31 @@
                 }
 
                 ui64 = (int64_t) f;
+                frac = 0;
+
+                if (frac_width) {
+
+                    scale = 1;
+                    for (n = frac_width; n; n--) {
+                        scale *= 10;
+                    }
+
+                    frac = (uint64_t) ((f - (double) ui64) * scale + 0.5);
+
+                    if (frac == scale) {
+                        ui64++;
+                        frac = 0;
+                    }
+                }
 
                 buf = ngx_sprintf_num(buf, last, ui64, zero, 0, width);
 
                 if (frac_width) {
-
                     if (buf < last) {
                         *buf++ = '.';
                     }
 
-                    scale = 1.0;
-
-                    for (n = frac_width; n; n--) {
-                        scale *= 10.0;
-                    }
-
-                    /*
-                     * (int64_t) cast is required for msvc6:
-                     * it cannot convert uint64_t to double
-                     */
-                    ui64 = (uint64_t) ((f - (int64_t) ui64) * scale + 0.5);
-
-                    buf = ngx_sprintf_num(buf, last, ui64, '0', 0, frac_width);
+                    buf = ngx_sprintf_num(buf, last, frac, '0', 0, frac_width);
                 }
 
                 fmt++;
--- a/src/event/ngx_event.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/event/ngx_event.c	Mon Apr 23 00:00:00 2012 +0400
@@ -21,6 +21,7 @@
 extern ngx_module_t ngx_select_module;
 
 
+static char *ngx_event_init_conf(ngx_cycle_t *cycle, void *conf);
 static ngx_int_t ngx_event_module_init(ngx_cycle_t *cycle);
 static ngx_int_t ngx_event_process_init(ngx_cycle_t *cycle);
 static char *ngx_events_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
@@ -31,8 +32,8 @@
 static char *ngx_event_debug_connection(ngx_conf_t *cf, ngx_command_t *cmd,
     void *conf);
 
-static void *ngx_event_create_conf(ngx_cycle_t *cycle);
-static char *ngx_event_init_conf(ngx_cycle_t *cycle, void *conf);
+static void *ngx_event_core_create_conf(ngx_cycle_t *cycle);
+static char *ngx_event_core_init_conf(ngx_cycle_t *cycle, void *conf);
 
 
 static ngx_uint_t     ngx_timer_resolution;
@@ -93,7 +94,7 @@
 static ngx_core_module_t  ngx_events_module_ctx = {
     ngx_string("events"),
     NULL,
-    NULL
+    ngx_event_init_conf
 };
 
 
@@ -173,8 +174,8 @@
 
 ngx_event_module_t  ngx_event_core_module_ctx = {
     &event_core_name,
-    ngx_event_create_conf,                 /* create configuration */
-    ngx_event_init_conf,                   /* init configuration */
+    ngx_event_core_create_conf,            /* create configuration */
+    ngx_event_core_init_conf,              /* init configuration */
 
     { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
 };
@@ -423,6 +424,19 @@
 }
 
 
+static char *
+ngx_event_init_conf(ngx_cycle_t *cycle, void *conf)
+{
+    if (ngx_get_conf(cycle->conf_ctx, ngx_events_module) == NULL) {
+        ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
+                      "no \"events\" section in configuration");
+        return NGX_CONF_ERROR;
+    }
+
+    return NGX_CONF_OK;
+}
+
+
 static ngx_int_t
 ngx_event_module_init(ngx_cycle_t *cycle)
 {
@@ -435,13 +449,6 @@
     ngx_event_conf_t    *ecf;
 
     cf = ngx_get_conf(cycle->conf_ctx, ngx_events_module);
-
-    if (cf == NULL) {
-        ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
-                      "no \"events\" section in configuration");
-        return NGX_ERROR;
-    }
-
     ecf = (*cf)[ngx_event_core_module.ctx_index];
 
     if (!ngx_test_config && ngx_process <= NGX_PROCESS_MASTER) {
@@ -471,7 +478,7 @@
                          (ngx_int_t) rlmt.rlim_cur : ccf->rlimit_nofile;
 
             ngx_log_error(NGX_LOG_WARN, cycle->log, 0,
-                          "%ui worker_connections are more than "
+                          "%ui worker_connections exceed "
                           "open file resource limit: %i",
                           ecf->connections, limit);
         }
@@ -489,7 +496,7 @@
     }
 
 
-    /* cl should be equal or bigger than cache line size */
+    /* cl should be equal to or greater than cache line size */
 
     cl = 128;
 
@@ -1116,7 +1123,7 @@
 
 
 static void *
-ngx_event_create_conf(ngx_cycle_t *cycle)
+ngx_event_core_create_conf(ngx_cycle_t *cycle)
 {
     ngx_event_conf_t  *ecf;
 
@@ -1147,7 +1154,7 @@
 
 
 static char *
-ngx_event_init_conf(ngx_cycle_t *cycle, void *conf)
+ngx_event_core_init_conf(ngx_cycle_t *cycle, void *conf)
 {
     ngx_event_conf_t  *ecf = conf;
 
--- a/src/http/modules/ngx_http_fastcgi_module.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/http/modules/ngx_http_fastcgi_module.c	Mon Apr 23 00:00:00 2012 +0400
@@ -1254,7 +1254,7 @@
 
             if (f->type == NGX_HTTP_FASTCGI_STDOUT && f->length == 0) {
                 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
-                              "upstream closed prematurely FastCGI stdout");
+                              "upstream prematurely closed FastCGI stdout");
 
                 return NGX_HTTP_UPSTREAM_INVALID_HEADER;
             }
@@ -2198,8 +2198,8 @@
 
     if (conf->upstream.busy_buffers_size < size) {
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-             "\"fastcgi_busy_buffers_size\" must be equal or bigger than "
-             "maximum of the value of \"fastcgi_buffer_size\" and "
+             "\"fastcgi_busy_buffers_size\" must be equal to or greater than "
+             "the maximum of the value of \"fastcgi_buffer_size\" and "
              "one of the \"fastcgi_buffers\"");
 
         return NGX_CONF_ERROR;
@@ -2229,8 +2229,8 @@
 
     if (conf->upstream.temp_file_write_size < size) {
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-             "\"fastcgi_temp_file_write_size\" must be equal or bigger than "
-             "maximum of the value of \"fastcgi_buffer_size\" and "
+             "\"fastcgi_temp_file_write_size\" must be equal to or greater "
+             "than the maximum of the value of \"fastcgi_buffer_size\" and "
              "one of the \"fastcgi_buffers\"");
 
         return NGX_CONF_ERROR;
@@ -2253,8 +2253,8 @@
     {
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
              "\"fastcgi_max_temp_file_size\" must be equal to zero to disable "
-             "the temporary files usage or must be equal or bigger than "
-             "maximum of the value of \"fastcgi_buffer_size\" and "
+             "temporary files usage or must be equal to or greater than "
+             "the maximum of the value of \"fastcgi_buffer_size\" and "
              "one of the \"fastcgi_buffers\"");
 
         return NGX_CONF_ERROR;
--- a/src/http/modules/ngx_http_geo_module.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/http/modules/ngx_http_geo_module.c	Mon Apr 23 00:00:00 2012 +0400
@@ -566,7 +566,7 @@
 
     if (ctx->binary_include) {
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-            "binary geo range base \"%s\" may not be mixed with usual entries",
+            "binary geo range base \"%s\" cannot be mixed with usual entries",
             ctx->include_name.data);
         return NGX_CONF_ERROR;
     }
@@ -1195,7 +1195,7 @@
 
     if (ctx->outside_entries) {
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-            "binary geo range base \"%s\" may not be mixed with usual entries",
+            "binary geo range base \"%s\" cannot be mixed with usual entries",
             name->data);
         rc = NGX_ERROR;
         goto done;
@@ -1203,7 +1203,7 @@
 
     if (ctx->binary_include) {
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-            "second binary geo range base \"%s\" may not be mixed with \"%s\"",
+            "second binary geo range base \"%s\" cannot be mixed with \"%s\"",
             name->data, ctx->include_name.data);
         rc = NGX_ERROR;
         goto done;
--- a/src/http/modules/ngx_http_image_filter_module.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/http/modules/ngx_http_image_filter_module.c	Mon Apr 23 00:00:00 2012 +0400
@@ -817,9 +817,7 @@
 
         resize = 0;
 
-        if ((ngx_uint_t) (dx * 100 / dy)
-            < ctx->max_width * 100 / ctx->max_height)
-        {
+        if ((double) dx / dy < (double) ctx->max_width / ctx->max_height) {
             if ((ngx_uint_t) dx > ctx->max_width) {
                 dy = dy * ctx->max_width / dx;
                 dy = dy ? dy : 1;
--- a/src/http/modules/ngx_http_proxy_module.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/http/modules/ngx_http_proxy_module.c	Mon Apr 23 00:00:00 2012 +0400
@@ -1497,6 +1497,10 @@
     u = r->upstream;
     ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
 
+    if (ctx == NULL) {
+        return NGX_ERROR;
+    }
+
     ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                    "http proxy filter init s:%d h:%d c:%d l:%O",
                    u->headers_in.status_n, ctx->head, u->headers_in.chunked,
@@ -1636,6 +1640,11 @@
     } state;
 
     ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
+
+    if (ctx == NULL) {
+        return NGX_ERROR;
+    }
+
     state = ctx->state;
 
     if (state == sw_chunk_data && ctx->size == 0) {
@@ -1883,6 +1892,10 @@
     r = p->input_ctx;
     ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
 
+    if (ctx == NULL) {
+        return NGX_ERROR;
+    }
+
     b = NULL;
     prev = &buf->shadow;
 
@@ -2064,6 +2077,11 @@
     ngx_http_proxy_ctx_t  *ctx;
 
     ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
+
+    if (ctx == NULL) {
+        return NGX_ERROR;
+    }
+
     u = r->upstream;
     buf = &u->buffer;
 
@@ -2734,8 +2752,8 @@
 
     if (conf->upstream.busy_buffers_size < size) {
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-             "\"proxy_busy_buffers_size\" must be equal or bigger than "
-             "maximum of the value of \"proxy_buffer_size\" and "
+             "\"proxy_busy_buffers_size\" must be equal to or greater than "
+             "the maximum of the value of \"proxy_buffer_size\" and "
              "one of the \"proxy_buffers\"");
 
         return NGX_CONF_ERROR;
@@ -2765,8 +2783,8 @@
 
     if (conf->upstream.temp_file_write_size < size) {
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-             "\"proxy_temp_file_write_size\" must be equal or bigger than "
-             "maximum of the value of \"proxy_buffer_size\" and "
+             "\"proxy_temp_file_write_size\" must be equal to or greater "
+             "than the maximum of the value of \"proxy_buffer_size\" and "
              "one of the \"proxy_buffers\"");
 
         return NGX_CONF_ERROR;
@@ -2788,8 +2806,8 @@
     {
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
              "\"proxy_max_temp_file_size\" must be equal to zero to disable "
-             "the temporary files usage or must be equal or bigger than "
-             "maximum of the value of \"proxy_buffer_size\" and "
+             "temporary files usage or must be equal to or greater than "
+             "the maximum of the value of \"proxy_buffer_size\" and "
              "one of the \"proxy_buffers\"");
 
         return NGX_CONF_ERROR;
@@ -3425,11 +3443,11 @@
     {
         if (plcf->vars.uri.len) {
             ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-                               "\"proxy_pass\" may not have URI part in "
+                               "\"proxy_pass\" cannot have URI part in "
                                "location given by regular expression, "
                                "or inside named location, "
-                               "or inside the \"if\" statement, "
-                               "or inside the \"limit_except\" block");
+                               "or inside \"if\" statement, "
+                               "or inside \"limit_except\" block");
             return NGX_CONF_ERROR;
         }
 
@@ -3498,14 +3516,14 @@
     if (ngx_strcmp(value[1].data, "default") == 0) {
         if (plcf->proxy_lengths) {
             ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-                               "\"proxy_redirect default\" may not be used "
+                               "\"proxy_redirect default\" cannot be used "
                                "with \"proxy_pass\" directive with variables");
             return NGX_CONF_ERROR;
         }
 
         if (plcf->url.data == NULL) {
             ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-                               "\"proxy_redirect default\" must go "
+                               "\"proxy_redirect default\" should be placed "
                                "after the \"proxy_pass\" directive");
             return NGX_CONF_ERROR;
         }
--- a/src/http/modules/ngx_http_scgi_module.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/http/modules/ngx_http_scgi_module.c	Mon Apr 23 00:00:00 2012 +0400
@@ -1173,8 +1173,8 @@
 
     if (conf->upstream.busy_buffers_size < size) {
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-            "\"scgi_busy_buffers_size\" must be equal or bigger "
-            "than maximum of the value of \"scgi_buffer_size\" and "
+            "\"scgi_busy_buffers_size\" must be equal to or greater "
+            "than the maximum of the value of \"scgi_buffer_size\" and "
             "one of the \"scgi_buffers\"");
 
         return NGX_CONF_ERROR;
@@ -1204,8 +1204,8 @@
 
     if (conf->upstream.temp_file_write_size < size) {
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-            "\"scgi_temp_file_write_size\" must be equal or bigger than "
-            "maximum of the value of \"scgi_buffer_size\" and "
+            "\"scgi_temp_file_write_size\" must be equal to or greater than "
+            "the maximum of the value of \"scgi_buffer_size\" and "
             "one of the \"scgi_buffers\"");
 
         return NGX_CONF_ERROR;
@@ -1227,8 +1227,8 @@
         && conf->upstream.max_temp_file_size < size) {
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
             "\"scgi_max_temp_file_size\" must be equal to zero to disable "
-            "the temporary files usage or must be equal or bigger than "
-            "maximum of the value of \"scgi_buffer_size\" and "
+            "temporary files usage or must be equal to or greater than "
+            "the maximum of the value of \"scgi_buffer_size\" and "
             "one of the \"scgi_buffers\"");
 
         return NGX_CONF_ERROR;
--- a/src/http/modules/ngx_http_split_clients_module.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/http/modules/ngx_http_split_clients_module.c	Mon Apr 23 00:00:00 2012 +0400
@@ -177,7 +177,7 @@
         sum = part[i].percent ? sum + part[i].percent : 10000;
         if (sum > 10000) {
             ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-                               "percent sum is more than 100%%");
+                               "percent total is greater than 100%%");
             return NGX_CONF_ERROR;
         }
 
--- a/src/http/modules/ngx_http_ssi_filter_module.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/http/modules/ngx_http_ssi_filter_module.c	Mon Apr 23 00:00:00 2012 +0400
@@ -2003,7 +2003,7 @@
 
     if (set && stub) {
         ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
-                      "\"set\" and \"stub\" may not be used together "
+                      "\"set\" and \"stub\" cannot be used together "
                       "in \"include\" SSI command");
         return NGX_HTTP_SSI_ERROR;
     }
@@ -2011,7 +2011,7 @@
     if (wait) {
         if (uri == NULL) {
             ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
-                          "\"wait\" may not be used with file=\"%V\"", file);
+                          "\"wait\" cannot be used with file=\"%V\"", file);
             return NGX_HTTP_SSI_ERROR;
         }
 
@@ -2188,7 +2188,7 @@
 
     } else {
         ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
-                      "only one subrequest may be waited at the same time");
+                      "can only wait for one subrequest at a time");
     }
 
     return NGX_OK;
--- a/src/http/modules/ngx_http_uwsgi_module.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/http/modules/ngx_http_uwsgi_module.c	Mon Apr 23 00:00:00 2012 +0400
@@ -1216,8 +1216,8 @@
 
     if (conf->upstream.busy_buffers_size < size) {
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-            "\"uwsgi_busy_buffers_size\" must be equal or bigger "
-            "than maximum of the value of \"uwsgi_buffer_size\" and "
+            "\"uwsgi_busy_buffers_size\" must be equal to or greater "
+            "than the maximum of the value of \"uwsgi_buffer_size\" and "
             "one of the \"uwsgi_buffers\"");
 
         return NGX_CONF_ERROR;
@@ -1247,8 +1247,8 @@
 
     if (conf->upstream.temp_file_write_size < size) {
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-            "\"uwsgi_temp_file_write_size\" must be equal or bigger than "
-            "maximum of the value of \"uwsgi_buffer_size\" and "
+            "\"uwsgi_temp_file_write_size\" must be equal to or greater than "
+            "the maximum of the value of \"uwsgi_buffer_size\" and "
             "one of the \"uwsgi_buffers\"");
 
         return NGX_CONF_ERROR;
@@ -1270,8 +1270,8 @@
         && conf->upstream.max_temp_file_size < size) {
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
             "\"uwsgi_max_temp_file_size\" must be equal to zero to disable "
-            "the temporary files usage or must be equal or bigger than "
-            "maximum of the value of \"uwsgi_buffer_size\" and "
+            "temporary files usage or must be equal to or greater than "
+            "the maximum of the value of \"uwsgi_buffer_size\" and "
             "one of the \"uwsgi_buffers\"");
 
         return NGX_CONF_ERROR;
--- a/src/http/modules/perl/nginx.pm	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/http/modules/perl/nginx.pm	Mon Apr 23 00:00:00 2012 +0400
@@ -50,7 +50,7 @@
     HTTP_INSUFFICIENT_STORAGE
 );
 
-our $VERSION = '1.1.19';
+our $VERSION = '1.2.0';
 
 require XSLoader;
 XSLoader::load('nginx', $VERSION);
--- a/src/http/ngx_http_core_module.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/http/ngx_http_core_module.c	Mon Apr 23 00:00:00 2012 +0400
@@ -1240,7 +1240,7 @@
             reserve = len > r->uri.len - alias ? len - (r->uri.len - alias) : 0;
         }
 
-        if (reserve > allocated) {
+        if (reserve > allocated || !allocated) {
 
             /* 16 bytes are preallocation */
             allocated = reserve + 16;
--- a/src/http/ngx_http_request.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/http/ngx_http_request.c	Mon Apr 23 00:00:00 2012 +0400
@@ -612,6 +612,8 @@
 
         c->ssl->no_wait_shutdown = 1;
 
+        c->log->action = "reading client request line";
+
         c->read->handler = ngx_http_process_request_line;
         /* STUB: epoll edge */ c->write->handler = ngx_http_empty_handler;
 
@@ -1175,7 +1177,7 @@
 
     if (n == 0) {
         ngx_log_error(NGX_LOG_INFO, c->log, 0,
-                      "client closed prematurely connection");
+                      "client prematurely closed connection");
     }
 
     if (n == 0 || n == NGX_ERROR) {
@@ -2426,7 +2428,7 @@
     }
 
     ngx_log_error(NGX_LOG_INFO, c->log, err,
-                  "client closed prematurely connection");
+                  "client prematurely closed connection");
 
     ngx_http_finalize_request(r, 0);
 }
--- a/src/http/ngx_http_request_body.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/http/ngx_http_request_body.c	Mon Apr 23 00:00:00 2012 +0400
@@ -303,7 +303,7 @@
 
             if (n == 0) {
                 ngx_log_error(NGX_LOG_INFO, c->log, 0,
-                              "client closed prematurely connection");
+                              "client prematurely closed connection");
             }
 
             if (n == 0 || n == NGX_ERROR) {
--- a/src/os/unix/ngx_darwin_sendfile_chain.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/os/unix/ngx_darwin_sendfile_chain.c	Mon Apr 23 00:00:00 2012 +0400
@@ -103,10 +103,8 @@
         prev = NULL;
         iov = NULL;
 
-        for (cl = in;
-             cl && header.nelts < IOV_MAX && send < limit;
-             cl = cl->next)
-        {
+        for (cl = in; cl && send < limit; cl = cl->next) {
+
             if (ngx_buf_special(cl->buf)) {
                 continue;
             }
@@ -125,6 +123,10 @@
                 iov->iov_len += (size_t) size;
 
             } else {
+                if (header.nelts >= IOV_MAX) {
+                    break;
+                }
+
                 iov = ngx_array_push(&header);
                 if (iov == NULL) {
                     return NGX_CHAIN_ERROR;
@@ -178,7 +180,7 @@
             prev = NULL;
             iov = NULL;
 
-            while (cl && header.nelts < IOV_MAX && send < limit) {
+            while (cl && send < limit) {
 
                 if (ngx_buf_special(cl->buf)) {
                     cl = cl->next;
@@ -199,6 +201,10 @@
                     iov->iov_len += (size_t) size;
 
                 } else {
+                    if (trailer.nelts >= IOV_MAX) {
+                        break;
+                    }
+
                     iov = ngx_array_push(&trailer);
                     if (iov == NULL) {
                         return NGX_CHAIN_ERROR;
--- a/src/os/unix/ngx_freebsd_sendfile_chain.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/os/unix/ngx_freebsd_sendfile_chain.c	Mon Apr 23 00:00:00 2012 +0400
@@ -107,10 +107,8 @@
         prev = NULL;
         iov = NULL;
 
-        for (cl = in;
-             cl && header.nelts < IOV_MAX && send < limit;
-             cl = cl->next)
-        {
+        for (cl = in; cl && send < limit; cl = cl->next) {
+
             if (ngx_buf_special(cl->buf)) {
                 continue;
             }
@@ -129,6 +127,10 @@
                 iov->iov_len += (size_t) size;
 
             } else {
+                if (header.nelts >= IOV_MAX){
+                    break;
+                }
+
                 iov = ngx_array_push(&header);
                 if (iov == NULL) {
                     return NGX_CHAIN_ERROR;
@@ -183,7 +185,7 @@
             prev = NULL;
             iov = NULL;
 
-            while (cl && header.nelts < IOV_MAX && send < limit) {
+            while (cl && send < limit) {
 
                 if (ngx_buf_special(cl->buf)) {
                     cl = cl->next;
@@ -204,6 +206,10 @@
                     iov->iov_len += (size_t) size;
 
                 } else {
+                    if (trailer.nelts >= IOV_MAX){
+                        break;
+                    }
+
                     iov = ngx_array_push(&trailer);
                     if (iov == NULL) {
                         return NGX_CHAIN_ERROR;
--- a/src/os/unix/ngx_linux_sendfile_chain.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/os/unix/ngx_linux_sendfile_chain.c	Mon Apr 23 00:00:00 2012 +0400
@@ -89,10 +89,8 @@
 
         /* create the iovec and coalesce the neighbouring bufs */
 
-        for (cl = in;
-             cl && header.nelts < IOV_MAX && send < limit;
-             cl = cl->next)
-        {
+        for (cl = in; cl && send < limit; cl = cl->next) {
+
             if (ngx_buf_special(cl->buf)) {
                 continue;
             }
@@ -132,6 +130,10 @@
                 iov->iov_len += (size_t) size;
 
             } else {
+                if (header.nelts >= IOV_MAX) {
+                    break;
+                }
+
                 iov = ngx_array_push(&header);
                 if (iov == NULL) {
                     return NGX_CHAIN_ERROR;
--- a/src/os/unix/ngx_readv_chain.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/os/unix/ngx_readv_chain.c	Mon Apr 23 00:00:00 2012 +0400
@@ -71,6 +71,10 @@
             iov->iov_len += chain->buf->end - chain->buf->last;
 
         } else {
+            if (vec.nelts >= IOV_MAX) {
+                break;
+            }
+
             iov = ngx_array_push(&vec);
             if (iov == NULL) {
                 return NGX_ERROR;
@@ -195,6 +199,10 @@
             iov->iov_len += chain->buf->end - chain->buf->last;
 
         } else {
+            if (vec.nelts >= IOV_MAX) {
+                break;
+            }
+
             iov = ngx_array_push(&vec);
             if (iov == NULL) {
                 return NGX_ERROR;
--- a/src/os/unix/ngx_solaris_sendfilev_chain.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/os/unix/ngx_solaris_sendfilev_chain.c	Mon Apr 23 00:00:00 2012 +0400
@@ -74,7 +74,6 @@
 
 
     send = 0;
-    complete = 0;
 
     vec.elts = sfvs;
     vec.size = sizeof(sendfilevec_t);
@@ -87,6 +86,7 @@
         fprev = 0;
         sfv = NULL;
         eintr = 0;
+        complete = 0;
         sent = 0;
         prev_send = send;
 
@@ -94,8 +94,8 @@
 
         /* create the sendfilevec and coalesce the neighbouring bufs */
 
-        for (cl = in; cl && vec.nelts < IOV_MAX && send < limit; cl = cl->next)
-        {
+        for (cl = in; cl && send < limit; cl = cl->next) {
+
             if (ngx_buf_special(cl->buf)) {
                 continue;
             }
@@ -113,6 +113,10 @@
                     sfv->sfv_len += (size_t) size;
 
                 } else {
+                    if (vec.nelts >= IOV_MAX) {
+                        break;
+                    }
+
                     sfv = ngx_array_push(&vec);
                     if (sfv == NULL) {
                         return NGX_CHAIN_ERROR;
@@ -147,6 +151,10 @@
                     sfv->sfv_len += (size_t) size;
 
                 } else {
+                    if (vec.nelts >= IOV_MAX) {
+                        break;
+                    }
+
                     sfv = ngx_array_push(&vec);
                     if (sfv == NULL) {
                         return NGX_CHAIN_ERROR;
--- a/src/os/unix/ngx_writev_chain.c	Thu Apr 12 00:00:00 2012 +0400
+++ b/src/os/unix/ngx_writev_chain.c	Mon Apr 23 00:00:00 2012 +0400
@@ -54,7 +54,6 @@
     }
 
     send = 0;
-    complete = 0;
 
     vec.elts = iovs;
     vec.size = sizeof(struct iovec);
@@ -65,14 +64,15 @@
         prev = NULL;
         iov = NULL;
         eintr = 0;
+        complete = 0;
         prev_send = send;
 
         vec.nelts = 0;
 
         /* create the iovec and coalesce the neighbouring bufs */
 
-        for (cl = in; cl && vec.nelts < IOV_MAX && send < limit; cl = cl->next)
-        {
+        for (cl = in; cl && send < limit; cl = cl->next) {
+
             if (ngx_buf_special(cl->buf)) {
                 continue;
             }
@@ -93,6 +93,10 @@
                 iov->iov_len += size;
 
             } else {
+                if (vec.nelts >= IOV_MAX) {
+                    break;
+                }
+
                 iov = ngx_array_push(&vec);
                 if (iov == NULL) {
                     return NGX_CHAIN_ERROR;