changeset 512:6557aef8a4b2 NGINX_0_8_8

nginx 0.8.8 *) Bugfix: in handling FastCGI headers split in records. *) Bugfix: a segmentation fault occurred in worker process, if a request was handled in two proxied or FastCGIed locations and a caching was enabled in the first location; the bug had appeared in 0.8.7.
author Igor Sysoev <http://sysoev.ru>
date Mon, 10 Aug 2009 00:00:00 +0400
parents e8f9a06185f3
children 16d97d9e72b7
files CHANGES CHANGES.ru src/core/nginx.h src/http/modules/ngx_http_fastcgi_module.c src/http/modules/perl/nginx.pm src/http/ngx_http_upstream.c
diffstat 6 files changed, 32 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,14 @@
 
+Changes with nginx 0.8.8                                         10 Aug 2009
+
+    *) Bugfix: in handling FastCGI headers split in records.
+
+    *) Bugfix: a segmentation fault occurred in worker process, if a 
+       request was handled in two proxied or FastCGIed locations and a 
+       caching was enabled in the first location; the bug had appeared in 
+       0.8.7.
+
+
 Changes with nginx 0.8.7                                         27 Jul 2009
 
     *) Change: minimum supported OpenSSL version is 0.9.7.
--- a/CHANGES.ru
+++ b/CHANGES.ru
@@ -1,4 +1,15 @@
 
+Изменения в nginx 0.8.8                                           10.08.2009
+
+    *) Исправление: в обработке заголовков ответа, разделённых в 
+       FastCGI-записях.
+
+    *) Исправление: если запрос обрабатывался в двух проксированных или 
+       FastCGI location'ах и в первом из них использовалось кэширование, то 
+       в рабочем процессе происходил segmentation fault; ошибка появилась в 
+       0.8.7.
+
+
 Изменения в nginx 0.8.7                                           27.07.2009
 
     *) Изменение: минимальная поддерживаемая версия OpenSSL - 0.9.7.
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,8 +8,8 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define nginx_version         8007
-#define NGINX_VERSION      "0.8.7"
+#define nginx_version         8008
+#define NGINX_VERSION      "0.8.8"
 #define NGINX_VER          "nginx/" NGINX_VERSION
 
 #define NGINX_VAR          "NGINX"
--- a/src/http/modules/ngx_http_fastcgi_module.c
+++ b/src/http/modules/ngx_http_fastcgi_module.c
@@ -1065,7 +1065,7 @@ ngx_http_fastcgi_reinit_request(ngx_http
 static ngx_int_t
 ngx_http_fastcgi_process_header(ngx_http_request_t *r)
 {
-    u_char                         *p, *start, *last, *part_start;
+    u_char                         *p, *start, *last, *part_start, *part_end;
     size_t                          size;
     ngx_str_t                      *status_line, line, *pattern;
     ngx_int_t                       rc, status;
@@ -1237,6 +1237,7 @@ ngx_http_fastcgi_process_header(ngx_http
         for ( ;; ) {
 
             part_start = u->buffer.pos;
+            part_end = u->buffer.last;
 
             rc = ngx_http_parse_header_line(r, &u->buffer, 1);
 
@@ -1437,7 +1438,11 @@ ngx_http_fastcgi_process_header(ngx_http
         part = ngx_array_push(f->split_parts);
 
         part->start = part_start;
-        part->end = u->buffer.last;
+        part->end = part_end;
+
+        if (u->buffer.pos < u->buffer.last) {
+            continue;
+        }
 
         return NGX_AGAIN;
     }
--- 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.8.7';
+our $VERSION = '0.8.8';
 
 require XSLoader;
 XSLoader::load('nginx', $VERSION);
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -2883,7 +2883,7 @@ ngx_http_upstream_finalize_request(ngx_h
 
 #if (NGX_HTTP_CACHE)
 
-    if (u->cacheable) {
+    if (u->cacheable && r->cache) {
         time_t  valid;
 
         ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,