changeset 246:b52bd034c577 NGINX_0_4_8

nginx 0.4.8 *) Bugfix: if an "include" SSI command were before another "include" SSI command with an "wait" parameter, then the "wait" parameter might not work. *) Bugfix: the ngx_http_flv_module added the FLV header to the full responses. Thanks to Alexey Kovyrin.
author Igor Sysoev <http://sysoev.ru>
date Wed, 11 Oct 2006 00:00:00 +0400
parents d75dbd68f5b2
children fcca101509a4
files CHANGES CHANGES.ru src/core/nginx.h src/core/ngx_list.c src/core/ngx_list.h src/http/modules/ngx_http_flv_module.c src/http/modules/ngx_http_ssi_filter_module.c src/http/ngx_http_variables.c
diffstat 8 files changed, 95 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,15 @@
 
+Changes with nginx 0.4.8                                         11 Oct 2006
+
+    *) Bugfix: if an "include" SSI command were before another "include" 
+       SSI command with an "wait" parameter, then the "wait" parameter 
+       might not work.
+
+    *) Bugfix: the ngx_http_flv_module added the FLV header to the full 
+       responses.
+       Thanks to Alexey Kovyrin.
+
+
 Changes with nginx 0.4.7                                         10 Oct 2006
 
     *) Feature: the ngx_http_flv_module.
@@ -8,8 +19,8 @@ Changes with nginx 0.4.7                
     *) Feature: the "charset" and "source_charset" directives support the 
        variables.
 
-    *) Bugfix: if before an "include" SSI command with an "wait" parameter 
-       were yet another "include" SSI command, then the "wait" parameter 
+    *) Bugfix: if an "include" SSI command were before another "include" 
+       SSI command with an "wait" parameter, then the "wait" parameter 
        might not work.
 
     *) Bugfix: if the "proxy_buffering off" directive was used or while 
--- a/CHANGES.ru
+++ b/CHANGES.ru
@@ -1,4 +1,15 @@
 
+Изменения в nginx 0.4.8                                           11.10.2006
+
+    *) Исправление: если до команды SSI include с параметром wait 
+       выполнялась ещё одна команда SSI include, то параметр wait мог не 
+       работать.
+
+    *) Исправление: модуль ngx_http_flv_module добавлял FLV-заголовок для 
+       полных ответов.
+       Спасибо Алексею Ковырину.
+
+
 Изменения в nginx 0.4.7                                           10.10.2006
 
     *) Добавление: модуль ngx_http_flv_module.
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VER          "nginx/0.4.7"
+#define NGINX_VER          "nginx/0.4.8"
 
 #define NGINX_VAR          "NGINX"
 #define NGX_OLDPID_EXT     ".oldbin"
--- a/src/core/ngx_list.c
+++ b/src/core/ngx_list.c
@@ -8,7 +8,34 @@
 #include <ngx_core.h>
 
 
-void *ngx_list_push(ngx_list_t *l)
+ngx_list_t *
+ngx_list_create(ngx_pool_t *pool, ngx_uint_t n, size_t size)
+{
+    ngx_list_t  *list;
+
+    list = ngx_palloc(pool, sizeof(ngx_list_t));
+    if (list == NULL) {
+        return NULL;
+    }
+
+    list->part.elts = ngx_palloc(pool, n * size);
+    if (list->part.elts == NULL) {
+        return NULL;
+    }
+
+    list->part.nelts = 0;
+    list->part.next = NULL;
+    list->last = &list->part;
+    list->size = size;
+    list->nalloc = n;
+    list->pool = pool;
+
+    return list;
+}
+
+
+void *
+ngx_list_push(ngx_list_t *l)
 {
     void             *elt;
     ngx_list_part_t  *last;
--- a/src/core/ngx_list.h
+++ b/src/core/ngx_list.h
@@ -30,9 +30,10 @@ typedef struct {
 } ngx_list_t;
 
 
-static ngx_inline
-ngx_int_t ngx_list_init(ngx_list_t *list, ngx_pool_t *pool, ngx_uint_t n,
-    size_t size)
+ngx_list_t *ngx_list_create(ngx_pool_t *pool, ngx_uint_t n, size_t size);
+
+static ngx_inline ngx_int_t
+ngx_list_init(ngx_list_t *list, ngx_pool_t *pool, ngx_uint_t n, size_t size)
 {
     list->part.elts = ngx_palloc(pool, n * size);
     if (list->part.elts == NULL) {
--- a/src/http/modules/ngx_http_flv_module.c
+++ b/src/http/modules/ngx_http_flv_module.c
@@ -64,7 +64,7 @@ ngx_http_flv_handler(ngx_http_request_t 
     off_t                      start, len;
     ngx_fd_t                   fd;
     ngx_int_t                  rc;
-    ngx_uint_t                 level;
+    ngx_uint_t                 level, i;
     ngx_str_t                  path;
     ngx_err_t                  err;
     ngx_log_t                 *log;
@@ -163,6 +163,7 @@ ngx_http_flv_handler(ngx_http_request_t 
 
     start = 0;
     len = ngx_file_size(&fi);
+    i = 1;
 
     if (r->args.len) {
         p = (u_char *) ngx_strstr(r->args.data, "start=");
@@ -176,7 +177,10 @@ ngx_http_flv_handler(ngx_http_request_t 
                 start = 0;
             }
 
-            len -= start;
+            if (start) {
+                len = sizeof(ngx_flv_header) - 1 + len - start;
+                i = 0;
+            }
         }
     }
 
@@ -190,24 +194,26 @@ ngx_http_flv_handler(ngx_http_request_t 
     clnf->log = r->pool->log;
 
     r->headers_out.status = NGX_HTTP_OK;
-    r->headers_out.content_length_n = sizeof(ngx_flv_header) - 1 + len;
+    r->headers_out.content_length_n = len;
     r->headers_out.last_modified_time = ngx_file_mtime(&fi);
 
     if (ngx_http_set_content_type(r) != NGX_OK) {
         return NGX_HTTP_INTERNAL_SERVER_ERROR;
     }
 
-    b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
-    if (b == NULL) {
-        return NGX_HTTP_INTERNAL_SERVER_ERROR;
-    }
+    if (i == 0) {
+        b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
+        if (b == NULL) {
+            return NGX_HTTP_INTERNAL_SERVER_ERROR;
+        }
 
-    b->pos = ngx_flv_header;
-    b->last = ngx_flv_header + sizeof(ngx_flv_header) - 1;
-    b->memory = 1;
+        b->pos = ngx_flv_header;
+        b->last = ngx_flv_header + sizeof(ngx_flv_header) - 1;
+        b->memory = 1;
 
-    out[0].buf = b;
-    out[0].next = &out[1];
+        out[0].buf = b;
+        out[0].next = &out[1];
+    }
 
     b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
     if (b == NULL) {
@@ -239,7 +245,7 @@ ngx_http_flv_handler(ngx_http_request_t 
     out[1].buf = b;
     out[1].next = NULL;
 
-    return ngx_http_output_filter(r, out);
+    return ngx_http_output_filter(r, &out[i]);
 }
 
 
--- a/src/http/modules/ngx_http_ssi_filter_module.c
+++ b/src/http/modules/ngx_http_ssi_filter_module.c
@@ -383,6 +383,7 @@ ngx_http_ssi_body_filter(ngx_http_reques
     ngx_chain_t               *cl, **ll;
     ngx_table_elt_t           *param;
     ngx_connection_t          *c;
+    ngx_http_request_t        *pr;
     ngx_http_ssi_ctx_t        *ctx, *mctx;
     ngx_http_ssi_block_t      *bl;
     ngx_http_ssi_param_t      *prm;
@@ -417,6 +418,23 @@ ngx_http_ssi_body_filter(ngx_http_reques
             return NGX_AGAIN;
         }
 
+        for (pr = ctx->wait->parent; pr; pr = pr->parent) {
+            if (pr == r) {
+                ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+                               "http ssi filter \"%V\" flush", &r->uri);
+
+                rc = ngx_http_next_body_filter(r, NULL);
+
+                if (ctx->wait->done) {
+                    ctx->wait = NULL;
+                }
+
+                if (rc == NGX_ERROR || rc == NGX_AGAIN) {
+                    return rc;
+                }
+            }
+        }
+
         if (ctx->wait == r) {
             ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                            "http ssi filter \"%V\" continue", &r->uri);
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -1145,11 +1145,7 @@ ngx_http_variable_request_body_file(ngx_
     ngx_http_variable_value_t *v, uintptr_t data)
 {
     if (r->request_body == NULL || r->request_body->temp_file == NULL) {
-        v->len = 0;
-        v->valid = 1;
-        v->no_cachable = 0;
-        v->not_found = 0;
-        v->data = (u_char *) "";
+        v->not_found = 1;
 
         return NGX_OK;
     }