]> git.kaiwu.me - nginx.git/commitdiff
high level HTTP buffered flags should be on per-subrequest basis,
authorIgor Sysoev <igor@sysoev.ru>
Mon, 30 Oct 2006 20:25:22 +0000 (20:25 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Mon, 30 Oct 2006 20:25:22 +0000 (20:25 +0000)
this fix a bug in SSI when a big static file is included

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

index 2c694fa27dcfe501c4690f28959257ace7abb8dd..1694dd451427b3cdff1b22349b3ee88e3172e6f5 100644 (file)
@@ -92,8 +92,8 @@ typedef enum {
 } 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 @@ struct ngx_connection_s {
 
     ngx_atomic_uint_t   number;
 
-    ngx_uint_t          buffered;
+    unsigned            buffered:8;
 
     unsigned            log_error:2;     /* ngx_connection_log_error_e */
 
index dc02498678b5a1a3562d82a01a5419c9fcf482be..1ee34db004748f11c998044d121523a91526ba39 100644 (file)
@@ -973,6 +973,13 @@ ngx_http_ssi_output(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx)
         }
     }
 
+    if (ctx->in || ctx->buf) {
+        r->buffered |= NGX_HTTP_SSI_BUFFERED;
+
+    } else {
+        r->buffered &= ~NGX_HTTP_SSI_BUFFERED;
+    }
+
     return rc;
 }
 
index 311c195b98aba482b28dd583efd023a5181f201b..c96dbfa765d476522a725f5b58c614061827af5d 100644 (file)
@@ -109,13 +109,21 @@ ngx_http_copy_filter(ngx_http_request_t *r, ngx_chain_t *in)
 
     rc = ngx_output_chain(ctx, in);
 
-#if (NGX_DEBUG)
     if (!c->destroyed) {
+
+        if (ctx->in == NULL) {
+            r->buffered &= ~NGX_HTTP_COPY_BUFFERED;
+        } else {
+            r->buffered |= NGX_HTTP_COPY_BUFFERED;
+        }
+
+#if (NGX_DEBUG)
         ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                        "copy filter: %i \"%V?%V\"", rc, &r->uri, &r->args);
-    }
 #endif
 
+    }
+
     return rc;
 }
 
index a7bbcddd5b039ba36f0abd371eef615133432d4e..951db75e4700f93b9f65640e894afbe09fd2d3ad 100644 (file)
@@ -1736,7 +1736,7 @@ ngx_http_writer(ngx_http_request_t *r)
             ngx_http_close_request(r, 0);
         }
 
-        if (r == r->main) {
+        if (r == r->main || r->buffered) {
             return;
         }
 
index 1e98b2df0e13ab6eb37bc8435dcf62c3d1282a73..57ffe4c7716e54fc138f33e5a34d31c15dfbe608 100644 (file)
 #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 @@ struct ngx_http_request_s {
     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;