changeset 829:362d156f0278

high level HTTP buffered flags should be on per-subrequest basis, this fix a bug in SSI when a big static file is included
author Igor Sysoev <igor@sysoev.ru>
date Mon, 30 Oct 2006 20:25:22 +0000
parents 597c83dad983
children 51b08975dfa3
files src/core/ngx_connection.h src/http/modules/ngx_http_ssi_filter_module.c src/http/ngx_http_copy_filter_module.c src/http/ngx_http_request.c src/http/ngx_http_request.h
diffstat 5 files changed, 28 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/ngx_connection.h	Mon Oct 30 20:03:49 2006 +0000
+++ b/src/core/ngx_connection.h	Mon Oct 30 20:25:22 2006 +0000
@@ -92,8 +92,8 @@
 } ngx_connection_tcp_nopush_e;
 
 
-#define NGX_LOWLEVEL_BUFFERED  0x0000000f
-#define NGX_SSL_BUFFERED       0x00000001
+#define NGX_LOWLEVEL_BUFFERED  0x0f
+#define NGX_SSL_BUFFERED       0x01
 
 
 struct ngx_connection_s {
@@ -133,7 +133,7 @@
 
     ngx_atomic_uint_t   number;
 
-    ngx_uint_t          buffered;
+    unsigned            buffered:8;
 
     unsigned            log_error:2;     /* ngx_connection_log_error_e */
 
--- a/src/http/modules/ngx_http_ssi_filter_module.c	Mon Oct 30 20:03:49 2006 +0000
+++ b/src/http/modules/ngx_http_ssi_filter_module.c	Mon Oct 30 20:25:22 2006 +0000
@@ -973,6 +973,13 @@
         }
     }
 
+    if (ctx->in || ctx->buf) {
+        r->buffered |= NGX_HTTP_SSI_BUFFERED;
+
+    } else {
+        r->buffered &= ~NGX_HTTP_SSI_BUFFERED;
+    }
+
     return rc;
 }
 
--- a/src/http/ngx_http_copy_filter_module.c	Mon Oct 30 20:03:49 2006 +0000
+++ b/src/http/ngx_http_copy_filter_module.c	Mon Oct 30 20:25:22 2006 +0000
@@ -109,12 +109,20 @@
 
     rc = ngx_output_chain(ctx, in);
 
+    if (!c->destroyed) {
+
+        if (ctx->in == NULL) {
+            r->buffered &= ~NGX_HTTP_COPY_BUFFERED;
+        } else {
+            r->buffered |= NGX_HTTP_COPY_BUFFERED;
+        }
+
 #if (NGX_DEBUG)
-    if (!c->destroyed) {
         ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                        "copy filter: %i \"%V?%V\"", rc, &r->uri, &r->args);
+#endif
+
     }
-#endif
 
     return rc;
 }
--- a/src/http/ngx_http_request.c	Mon Oct 30 20:03:49 2006 +0000
+++ b/src/http/ngx_http_request.c	Mon Oct 30 20:25:22 2006 +0000
@@ -1736,7 +1736,7 @@
             ngx_http_close_request(r, 0);
         }
 
-        if (r == r->main) {
+        if (r == r->main || r->buffered) {
             return;
         }
 
--- a/src/http/ngx_http_request.h	Mon Oct 30 20:03:49 2006 +0000
+++ b/src/http/ngx_http_request.h	Mon Oct 30 20:25:22 2006 +0000
@@ -111,11 +111,11 @@
 #define NGX_HTTP_INSUFFICIENT_STORAGE      507
 
 
-#define NGX_HTTP_LOWLEVEL_BUFFERED         0x000000f0
-#define NGX_HTTP_WRITE_BUFFERED            0x00000010
-#define NGX_HTTP_GZIP_BUFFERED             0x00000020
-#define NGX_HTTP_SSI_BUFFERED              0x00000100
-#define NGX_HTTP_COPY_BUFFERED             0x00000200
+#define NGX_HTTP_LOWLEVEL_BUFFERED         0xf0
+#define NGX_HTTP_WRITE_BUFFERED            0x10
+#define NGX_HTTP_GZIP_BUFFERED             0x20
+#define NGX_HTTP_SSI_BUFFERED              0x01
+#define NGX_HTTP_COPY_BUFFERED             0x02
 
 
 typedef enum {
@@ -452,6 +452,8 @@
     unsigned                          done:1;
     unsigned                          utf8:1;
 
+    unsigned                          buffered:4;
+
     unsigned                          main_filter_need_in_memory:1;
     unsigned                          filter_need_in_memory:1;
     unsigned                          filter_need_temporary:1;