changeset 434:49a0eb7ce20c NGINX_0_7_29

nginx 0.7.29 *) Bugfix: the "fastcgi_pass" and "proxy_pass" directives did not support variables if unix domain sockets were used. *) Bugfixes in subrequest processing; the bugs had appeared in 0.7.25. *) Bugfix: a "100 Continue" response was issued for HTTP/1.0 requests; Thanks to Maxim Dounin. *) Bugfix: in memory allocation in the ngx_http_gzip_filter_module on Cygwin.
author Igor Sysoev <http://sysoev.ru>
date Wed, 24 Dec 2008 00:00:00 +0300
parents 18f6c20ac73a
children afc35e97690d
files CHANGES CHANGES.ru src/core/nginx.h src/http/modules/ngx_http_fastcgi_module.c src/http/modules/ngx_http_gzip_filter_module.c src/http/modules/ngx_http_proxy_module.c src/http/modules/ngx_http_ssi_filter_module.c src/http/modules/perl/nginx.pm src/http/ngx_http_core_module.c src/http/ngx_http_upstream.c src/http/ngx_http_upstream.h src/http/ngx_http_upstream_round_robin.c
diffstat 12 files changed, 114 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES	Mon Dec 22 00:00:00 2008 +0300
+++ b/CHANGES	Wed Dec 24 00:00:00 2008 +0300
@@ -1,4 +1,18 @@
 
+Changes with nginx 0.7.29                                        24 Dec 2008
+
+    *) Bugfix: the "fastcgi_pass" and "proxy_pass" directives did not 
+       support variables if unix domain sockets were used.
+
+    *) Bugfixes in subrequest processing; the bugs had appeared in 0.7.25.
+
+    *) Bugfix: a "100 Continue" response was issued for HTTP/1.0 requests; 
+       Thanks to Maxim Dounin.
+
+    *) Bugfix: in memory allocation in the ngx_http_gzip_filter_module on 
+       Cygwin.
+
+
 Changes with nginx 0.7.28                                        22 Dec 2008
 
     *) Change: in memory allocation in the ngx_http_gzip_filter_module.
--- a/CHANGES.ru	Mon Dec 22 00:00:00 2008 +0300
+++ b/CHANGES.ru	Wed Dec 24 00:00:00 2008 +0300
@@ -1,9 +1,23 @@
 
+Изменения в nginx 0.7.29                                          24.12.2008
+
+    *) Исправление: директивы fastcgi_pass и proxy_pass не поддерживали 
+       переменные при использовании unix domain сокетов.
+
+    *) Исправления в обработке подзапросов; ошибки появилась в 0.7.25.
+
+    *) Исправление: ответ "100 Continue" выдавался для запросов версии 
+       HTTP/1.0; Спасибо Максиму Дунину.
+
+    *) Исправление: в выделении памяти в модуле ngx_http_gzip_filter_module 
+       под Cygwin.
+
+
 Изменения в nginx 0.7.28                                          22.12.2008
 
     *) Изменение: в выделении памяти в модуле ngx_http_gzip_filter_module.
 
-    *) Изменение: значения по умолчанию для директивы gzip_values изменены 
+    *) Изменение: значения по умолчанию для директивы gzip_buffers изменены 
        с 4 4k/8k на 32 4k или 16 8k.
 
 
--- a/src/core/nginx.h	Mon Dec 22 00:00:00 2008 +0300
+++ b/src/core/nginx.h	Wed Dec 24 00:00:00 2008 +0300
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VERSION      "0.7.28"
+#define NGINX_VERSION      "0.7.29"
 #define NGINX_VER          "nginx/" NGINX_VERSION
 
 #define NGINX_VAR          "NGINX"
--- a/src/http/modules/ngx_http_fastcgi_module.c	Mon Dec 22 00:00:00 2008 +0300
+++ b/src/http/modules/ngx_http_fastcgi_module.c	Wed Dec 24 00:00:00 2008 +0300
@@ -512,8 +512,16 @@
         return NGX_ERROR;
     }
 
-    r->upstream->resolved->host = u.host;
-    r->upstream->resolved->port = u.port;
+    if (u.addrs[0].sockaddr) {
+        r->upstream->resolved->sockaddr = u.addrs[0].sockaddr;
+        r->upstream->resolved->socklen = u.addrs[0].socklen;
+        r->upstream->resolved->naddrs = 1;
+        r->upstream->resolved->host = u.addrs[0].name;
+
+    } else {
+        r->upstream->resolved->host = u.host;
+        r->upstream->resolved->port = u.port;
+    }
 
     return NGX_OK;
 }
--- a/src/http/modules/ngx_http_gzip_filter_module.c	Mon Dec 22 00:00:00 2008 +0300
+++ b/src/http/modules/ngx_http_gzip_filter_module.c	Wed Dec 24 00:00:00 2008 +0300
@@ -938,14 +938,14 @@
 
     alloc = items * size;
 
-    if (alloc % 512 != 0) {
+    if (alloc % 512 != 0 && alloc < 8192) {
 
         /*
          * The zlib deflate_state allocation, it takes about 6K,
          * we allocate 8K.  Other allocations are divisible by 512.
          */
 
-        alloc = (alloc + ngx_pagesize - 1) & ~(ngx_pagesize - 1);
+        alloc = 8192;
     }
 
     if (alloc <= ctx->allocated) {
--- a/src/http/modules/ngx_http_proxy_module.c	Mon Dec 22 00:00:00 2008 +0300
+++ b/src/http/modules/ngx_http_proxy_module.c	Wed Dec 24 00:00:00 2008 +0300
@@ -614,10 +614,18 @@
         return NGX_ERROR;
     }
 
-    r->upstream->resolved->host = u.host;
-    r->upstream->resolved->port = (in_port_t) (u.no_port ? u.default_port:
-                                                           u.port);
-    r->upstream->resolved->no_port = u.no_port;
+    if (u.addrs[0].sockaddr) {
+        r->upstream->resolved->sockaddr = u.addrs[0].sockaddr;
+        r->upstream->resolved->socklen = u.addrs[0].socklen;
+        r->upstream->resolved->naddrs = 1;
+        r->upstream->resolved->host = u.addrs[0].name;
+
+    } else {
+        r->upstream->resolved->host = u.host;
+        r->upstream->resolved->port = (in_port_t) (u.no_port ? u.default_port:
+                                                               u.port);
+        r->upstream->resolved->no_port = u.no_port;
+    }
 
     return NGX_OK;
 }
--- a/src/http/modules/ngx_http_ssi_filter_module.c	Mon Dec 22 00:00:00 2008 +0300
+++ b/src/http/modules/ngx_http_ssi_filter_module.c	Wed Dec 24 00:00:00 2008 +0300
@@ -1881,6 +1881,7 @@
 
     if (uri == NULL) {
         uri = file;
+        wait = (ngx_str_t *) -1;
     }
 
     rc = ngx_http_ssi_evaluate_string(r, ctx, uri, NGX_HTTP_SSI_ADD_PREFIX);
--- a/src/http/modules/perl/nginx.pm	Mon Dec 22 00:00:00 2008 +0300
+++ b/src/http/modules/perl/nginx.pm	Wed Dec 24 00:00:00 2008 +0300
@@ -47,7 +47,7 @@
     HTTP_INSUFFICIENT_STORAGE
 );
 
-our $VERSION = '0.7.28';
+our $VERSION = '0.7.29';
 
 require XSLoader;
 XSLoader::load('nginx', $VERSION);
--- a/src/http/ngx_http_core_module.c	Mon Dec 22 00:00:00 2008 +0300
+++ b/src/http/ngx_http_core_module.c	Wed Dec 24 00:00:00 2008 +0300
@@ -862,7 +862,7 @@
         return NGX_OK;
     }
 
-    if (r->headers_in.expect) {
+    if (r->headers_in.expect && r->http_version > NGX_HTTP_VERSION_10) {
         expect = ngx_http_core_send_continue(r);
 
         if (expect != NGX_OK) {
@@ -1082,7 +1082,6 @@
 
             e.ip = tf->lengths->elts;
             e.request = r;
-            e.flushed = 1;
 
             /* 1 is for terminating '\0' as in static names */
             len = 1;
@@ -1127,6 +1126,7 @@
         } else {
             e.ip = tf->values->elts;
             e.pos = name;
+            e.flushed = 1;
 
             while (*(uintptr_t *) e.ip) {
                 code = *(ngx_http_script_code_pt *) e.ip;
@@ -2093,7 +2093,7 @@
     sr->read_event_handler = ngx_http_request_empty_handler;
     sr->write_event_handler = ngx_http_handler;
 
-    if (c->data == r) {
+    if (c->data == r && r->postponed == NULL) {
         c->data = sr;
     }
 
--- a/src/http/ngx_http_upstream.c	Mon Dec 22 00:00:00 2008 +0300
+++ b/src/http/ngx_http_upstream.c	Wed Dec 24 00:00:00 2008 +0300
@@ -414,6 +414,20 @@
 
     } else {
 
+        if (u->resolved->sockaddr) {
+
+            if (ngx_http_upstream_create_round_robin_peer(r, u->resolved)
+                != NGX_OK)
+            {
+                ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+                return;
+            }
+
+            ngx_http_upstream_connect(r, u);
+
+            return;
+        }
+
         host = &u->resolved->host;
 
         umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module);
--- a/src/http/ngx_http_upstream.h	Mon Dec 22 00:00:00 2008 +0300
+++ b/src/http/ngx_http_upstream.h	Wed Dec 24 00:00:00 2008 +0300
@@ -209,8 +209,13 @@
     ngx_str_t                       host;
     in_port_t                       port;
     ngx_uint_t                      no_port; /* unsigned  no_port:1 */
+
     ngx_uint_t                      naddrs;
     in_addr_t                      *addrs;
+
+    struct sockaddr                *sockaddr;
+    socklen_t                       socklen;
+
     ngx_resolver_ctx_t             *ctx;
 } ngx_http_upstream_resolved_t;
 
--- a/src/http/ngx_http_upstream_round_robin.c	Mon Dec 22 00:00:00 2008 +0300
+++ b/src/http/ngx_http_upstream_round_robin.c	Wed Dec 24 00:00:00 2008 +0300
@@ -279,35 +279,47 @@
     peers->number = ur->naddrs;
     peers->name = &ur->host;
 
-    for (i = 0; i < ur->naddrs; i++) {
-
-        len = NGX_INET_ADDRSTRLEN + sizeof(":65536") - 1;
+    if (ur->sockaddr) {
+        peers->peer[0].sockaddr = ur->sockaddr;
+        peers->peer[0].socklen = ur->socklen;
+        peers->peer[0].name = ur->host;
+        peers->peer[0].weight = 1;
+        peers->peer[0].current_weight = 1;
+        peers->peer[0].max_fails = 1;
+        peers->peer[0].fail_timeout = 10;
 
-        p = ngx_pnalloc(r->pool, len);
-        if (p == NULL) {
-            return NGX_ERROR;
-        }
+    } else {
+
+        for (i = 0; i < ur->naddrs; i++) {
 
-        len = ngx_inet_ntop(AF_INET, &ur->addrs[i], p, NGX_INET_ADDRSTRLEN);
-        len = ngx_sprintf(&p[len], ":%d", ur->port) - p;
+            len = NGX_INET_ADDRSTRLEN + sizeof(":65536") - 1;
+
+            p = ngx_pnalloc(r->pool, len);
+            if (p == NULL) {
+                return NGX_ERROR;
+            }
 
-        sin = ngx_pcalloc(r->pool, sizeof(struct sockaddr_in));
-        if (sin == NULL) {
-            return NGX_ERROR;
-        }
+            len = ngx_inet_ntop(AF_INET, &ur->addrs[i], p, NGX_INET_ADDRSTRLEN);
+            len = ngx_sprintf(&p[len], ":%d", ur->port) - p;
 
-        sin->sin_family = AF_INET;
-        sin->sin_port = htons(ur->port);
-        sin->sin_addr.s_addr = ur->addrs[i];
+            sin = ngx_pcalloc(r->pool, sizeof(struct sockaddr_in));
+            if (sin == NULL) {
+                return NGX_ERROR;
+            }
 
-        peers->peer[i].sockaddr = (struct sockaddr *) sin;
-        peers->peer[i].socklen = sizeof(struct sockaddr_in);
-        peers->peer[i].name.len = len;
-        peers->peer[i].name.data = p;
-        peers->peer[i].weight = 1;
-        peers->peer[i].current_weight = 1;
-        peers->peer[i].max_fails = 1;
-        peers->peer[i].fail_timeout = 10;
+            sin->sin_family = AF_INET;
+            sin->sin_port = htons(ur->port);
+            sin->sin_addr.s_addr = ur->addrs[i];
+
+            peers->peer[i].sockaddr = (struct sockaddr *) sin;
+            peers->peer[i].socklen = sizeof(struct sockaddr_in);
+            peers->peer[i].name.len = len;
+            peers->peer[i].name.data = p;
+            peers->peer[i].weight = 1;
+            peers->peer[i].current_weight = 1;
+            peers->peer[i].max_fails = 1;
+            peers->peer[i].fail_timeout = 10;
+        }
     }
 
     rrp->peers = peers;