changeset 284:3dbecd747fbb NGINX_0_5_12

nginx 0.5.12 *) Bugfix: nginx could not be built on platforms different from i386, amd64, sparc и ppc; bug appeared in 0.5.8. *) Bugfix: a segmentation fault might occur in worker process if the temporarily files were used while working with FastCGI server; bug appeared in 0.5.8. *) Bugfix: a segmentation fault might occur in worker process if the $fastcgi_script_name variable was logged. *) Bugfix: ngx_http_perl_module could not be built on Solaris.
author Igor Sysoev <http://sysoev.ru>
date Mon, 12 Feb 2007 00:00:00 +0300
parents 48810289fcb1
children 0e505c8b6528
files CHANGES CHANGES.ru src/core/nginx.h src/core/ngx_cycle.c src/core/ngx_shmtx.c src/event/ngx_event_pipe.c src/http/modules/ngx_http_fastcgi_module.c src/http/modules/perl/nginx.pm src/http/ngx_http_upstream.c src/os/unix/ngx_solaris_config.h
diffstat 10 files changed, 89 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,19 @@
 
+Changes with nginx 0.5.12                                        12 Feb 2007
+
+    *) Bugfix: nginx could not be built on platforms different from i386, 
+       amd64, sparc и ppc; bug appeared in 0.5.8.
+
+    *) Bugfix: a segmentation fault might occur in worker process if the 
+       temporarily files were used while working with FastCGI server; bug 
+       appeared in 0.5.8.
+
+    *) Bugfix: a segmentation fault might occur in worker process if the 
+       $fastcgi_script_name variable was logged.
+
+    *) Bugfix: ngx_http_perl_module could not be built on Solaris.
+
+
 Changes with nginx 0.5.11                                        05 Feb 2007
 
     *) Feature: now configure detects system PCRE library in MacPorts.
--- a/CHANGES.ru
+++ b/CHANGES.ru
@@ -1,4 +1,19 @@
 
+Изменения в nginx 0.5.12                                          12.02.2007
+
+    *) Исправление: nginx не собирался на платформах, отличных от i386, 
+       amd64, sparc и ppc; ошибка появилась в 0.5.8.
+
+    *) Исправление: при использовании временных файлов в время работы с 
+       FastCGI-сервером в рабочем процессе мог произойти segmentation 
+       fault; ошибка появилась в 0.5.8.
+
+    *) Исправление: если переменная $fastcgi_script_name записывалась в 
+       лог, то в рабочем процессе мог произойти segmentation fault.
+
+    *) Исправление: ngx_http_perl_module не собирался на Solaris.
+
+
 Изменения в nginx 0.5.11                                          05.02.2007
 
     *) Добавление: теперь configure определяет библиотеку PCRE в 
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VERSION      "0.5.11"
+#define NGINX_VERSION      "0.5.12"
 #define NGINX_VER          "nginx/" NGINX_VERSION
 
 #define NGINX_VAR          "NGINX"
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -901,7 +901,8 @@ ngx_test_lockfile(u_char *file, ngx_log_
 #if !(NGX_HAVE_ATOMIC_OPS)
     ngx_fd_t  fd;
 
-    fd = ngx_open_file(file, NGX_FILE_RDWR, NGX_FILE_CREATE_OR_OPEN);
+    fd = ngx_open_file(file, NGX_FILE_RDWR, NGX_FILE_CREATE_OR_OPEN,
+                       NGX_FILE_DEFAULT_ACCESS);
 
     if (fd == NGX_INVALID_FILE) {
         ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
--- a/src/core/ngx_shmtx.c
+++ b/src/core/ngx_shmtx.c
@@ -35,7 +35,8 @@ ngx_shmtx_create(ngx_shmtx_t *mtx, void 
         ngx_shmtx_destory(mtx);
     }
 
-    mtx->fd = ngx_open_file(name, NGX_FILE_RDWR, NGX_FILE_CREATE_OR_OPEN);
+    mtx->fd = ngx_open_file(name, NGX_FILE_RDWR, NGX_FILE_CREATE_OR_OPEN,
+                            NGX_FILE_DEFAULT_ACCESS);
 
     if (mtx->fd == NGX_INVALID_FILE) {
         ngx_log_error(NGX_LOG_EMERG, ngx_cycle->log, ngx_errno,
--- a/src/event/ngx_event_pipe.c
+++ b/src/event/ngx_event_pipe.c
@@ -419,6 +419,7 @@ ngx_event_pipe_read_upstream(ngx_event_p
 static ngx_int_t
 ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p)
 {
+    u_char            *prev;
     size_t             bsize;
     ngx_uint_t         flush, prev_last_shadow;
     ngx_chain_t       *out, **ll, *cl;
@@ -497,11 +498,18 @@ ngx_event_pipe_write_to_downstream(ngx_e
 
         /* bsize is the size of the busy recycled bufs */
 
+        prev = NULL;
         bsize = 0;
 
         for (cl = p->busy; cl; cl = cl->next) {
+
             if (cl->buf->recycled) {
+                if (prev == cl->buf->start) {
+                    continue;
+                }
+
                 bsize += cl->buf->end - cl->buf->start;
+                prev = cl->buf->start;
             }
         }
 
@@ -509,8 +517,14 @@ ngx_event_pipe_write_to_downstream(ngx_e
                        "pipe write busy: %uz", bsize);
 
         out = NULL;
+
+        if (bsize >= (size_t) p->busy_size) {
+            flush = 1;
+            goto flush;
+        }
+
+        flush = 0;
         ll = NULL;
-        flush = 0;
         prev_last_shadow = 1;
 
         for ( ;; ) {
@@ -579,6 +593,8 @@ ngx_event_pipe_write_to_downstream(ngx_e
             ll = &cl->next;
         }
 
+    flush:
+
         ngx_log_debug2(NGX_LOG_DEBUG_EVENT, p->log, 0,
                        "pipe write: out:%p, f:%d", out, flush);
 
--- a/src/http/modules/ngx_http_fastcgi_module.c
+++ b/src/http/modules/ngx_http_fastcgi_module.c
@@ -1969,28 +1969,39 @@ ngx_http_fastcgi_script_name_variable(ng
     u_char                       *p;
     ngx_http_fastcgi_loc_conf_t  *flcf;
 
-    v->valid = 1;
-    v->no_cachable = 0;
-    v->not_found = 0;
-
-    flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module);
-
-    if (r->uri.data[r->uri.len - 1] != '/') {
-        v->len = r->uri.len;
-        v->data = r->uri.data;
+    if (r->uri.len) {
+        v->valid = 1;
+        v->no_cachable = 0;
+        v->not_found = 0;
+
+        flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module);
+
+        if (r->uri.data[r->uri.len - 1] != '/') {
+            v->len = r->uri.len;
+            v->data = r->uri.data;
+            return NGX_OK;
+        }
+
+        v->len = r->uri.len + flcf->index.len;
+
+        v->data = ngx_palloc(r->pool, v->len);
+        if (v->data == NULL) {
+            return NGX_ERROR;
+        }
+
+        p = ngx_copy(v->data, r->uri.data, r->uri.len);
+        ngx_memcpy(p, flcf->index.data, flcf->index.len);
+
+    } else {
+        v->len = 0;
+        v->valid = 1;
+        v->no_cachable = 0;
+        v->not_found = 0;
+        v->data = NULL;
+
         return NGX_OK;
     }
 
-    v->len = r->uri.len + flcf->index.len;
-
-    v->data = ngx_palloc(r->pool, v->len);
-    if (v->data == NULL) {
-        return NGX_ERROR;
-    }
-
-    p = ngx_copy(v->data, r->uri.data, r->uri.len);
-    ngx_memcpy(p, flcf->index.data, flcf->index.len);
-
     return NGX_OK;
 }
 
--- 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.5.11';
+our $VERSION = '0.5.12';
 
 require XSLoader;
 XSLoader::load('nginx', $VERSION);
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -1784,6 +1784,7 @@ ngx_http_upstream_process_body(ngx_event
 {
     ngx_event_pipe_t     *p;
     ngx_connection_t     *c, *downstream;
+    ngx_http_log_ctx_t   *ctx;
     ngx_http_request_t   *r;
     ngx_http_upstream_t  *u;
 
@@ -1801,6 +1802,9 @@ ngx_http_upstream_process_body(ngx_event
         ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
                        "http upstream process upstream");
         c->log->action = "reading upstream";
+
+        ctx = c->log->data;
+        ctx->current_request = r;
     }
 
     p = u->pipe;
--- a/src/os/unix/ngx_solaris_config.h
+++ b/src/os/unix/ngx_solaris_config.h
@@ -8,7 +8,9 @@
 #define _NGX_SOLARIS_CONFIG_H_INCLUDED_
 
 
+#ifndef _REENTRANT
 #define _REENTRANT
+#endif
 
 #define _FILE_OFFSET_BITS  64   /* must be before <sys/types.h> */