diff src/http/ngx_http_write_filter.c @ 48:6cfc63e68377 NGINX_0_1_24

nginx 0.1.24 *) Feature: the ngx_http_ssi_filter_module supports the QUERY_STRING and DOCUMENT_URI variables. *) Bugfix: the ngx_http_autoindex_module may some times return the 404 response for existent directory, if this directory was used in "alias" directive. *) Bugfix: the ngx_http_ssi_filter_module ran incorrectly for large responses. *) Bugfix: the lack of the "Referer" header line was always accounted as valid referrer.
author Igor Sysoev <http://sysoev.ru>
date Fri, 04 Mar 2005 00:00:00 +0300
parents 2879cd3a40cb
children
line wrap: on
line diff
--- a/src/http/ngx_http_write_filter.c
+++ b/src/http/ngx_http_write_filter.c
@@ -44,8 +44,8 @@ ngx_module_t  ngx_http_write_filter_modu
 
 ngx_int_t ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in)
 {
-    int                           last;
-    off_t                         size, flush, sent;
+    off_t                         size, sent;
+    ngx_uint_t                    last, flush;
     ngx_chain_t                  *cl, *ln, **ll, *chain;
     ngx_connection_t             *c;
     ngx_http_core_loc_conf_t     *clcf;
@@ -101,7 +101,7 @@ ngx_int_t ngx_http_write_filter(ngx_http
         size += ngx_buf_size(cl->buf);
 
         if (cl->buf->flush || cl->buf->recycled) {
-            flush = size;
+            flush = 1;
         }
 
         if (cl->buf->last_buf) {
@@ -152,7 +152,7 @@ ngx_int_t ngx_http_write_filter(ngx_http
         size += ngx_buf_size(cl->buf);
 
         if (cl->buf->flush || cl->buf->recycled) {
-            flush = size;
+            flush = 1;
         }
 
         if (cl->buf->last_buf) {
@@ -165,7 +165,7 @@ ngx_int_t ngx_http_write_filter(ngx_http
     c = r->connection;
 
     ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0,
-                   "http write filter: l:%d f:%O s:%O", last, flush, size);
+                   "http write filter: l:%d f:%d s:%O", last, flush, size);
 
     clcf = ngx_http_get_module_loc_conf(r->main ? r->main : r,
                                         ngx_http_core_module);
@@ -176,7 +176,7 @@ ngx_int_t ngx_http_write_filter(ngx_http
      * is smaller than "postpone_output" directive
      */
 
-    if (!last && flush == 0 && in && size < (off_t) clcf->postpone_output) {
+    if (!last && !flush && in && size < (off_t) clcf->postpone_output) {
         return NGX_OK;
     }
 
@@ -189,6 +189,11 @@ ngx_int_t ngx_http_write_filter(ngx_http
             return NGX_OK;
         }
 
+        if (flush) {
+            while ((ctx->out = ctx->out->next)) { /* void */ }
+            return NGX_OK;
+        }
+
         ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
                       "the http output chain is empty");