diff src/http/ngx_http_write_filter.c @ 10:46833bd150cb NGINX_0_1_5

nginx 0.1.5 *) Bugfix: on Solaris and Linux there may be too many "recvmsg() returned not enough data" alerts. *) Bugfix: there were the "writev() failed (22: Invalid argument)" errors on Solaris in proxy mode without sendfile. On other platforms that do not support sendfile at all the process got caught in an endless loop. *) Bugfix: segmentation fault on Solaris in proxy mode and using sendfile. *) Bugfix: segmentation fault on Solaris. *) Bugfix: on-line upgrade did not work on Linux. *) Bugfix: the ngx_http_autoindex_module module did not escape the spaces, the quotes, and the percent signs in the directory listing. *) Change: the decrease of the copy operations. *) Feature: the userid_p3p directive.
author Igor Sysoev <http://sysoev.ru>
date Thu, 11 Nov 2004 00:00:00 +0300
parents 4b2dafa26fe2
children 8b6db3bda591
line wrap: on
line diff
--- a/src/http/ngx_http_write_filter.c
+++ b/src/http/ngx_http_write_filter.c
@@ -69,6 +69,12 @@ ngx_int_t ngx_http_write_filter(ngx_http
     for (cl = ctx->out; cl; cl = cl->next) {
         ll = &cl->next;
 
+#if 1
+        if (ngx_buf_size(cl->buf) == 0 && !ngx_buf_special(cl->buf)) {
+            ngx_debug_point();
+        }
+#endif
+
         size += ngx_buf_size(cl->buf);
 
         if (cl->buf->flush || cl->buf->recycled) {
@@ -83,10 +89,20 @@ ngx_int_t ngx_http_write_filter(ngx_http
     /* add the new chain to the existent one */
 
     for (ln = in; ln; ln = ln->next) {
-        ngx_alloc_link_and_set_buf(cl, ln->buf, r->pool, NGX_ERROR);
+        if (!(cl = ngx_alloc_chain_link(r->pool))) {
+            return NGX_ERROR;
+        }
+
+        cl->buf = ln->buf;
         *ll = cl;
         ll = &cl->next;
 
+#if 1
+        if (ngx_buf_size(cl->buf) == 0 && !ngx_buf_special(cl->buf)) {
+            ngx_debug_point();
+        }
+#endif
+
         size += ngx_buf_size(cl->buf);
 
         if (cl->buf->flush || cl->buf->recycled) {
@@ -98,11 +114,12 @@ ngx_int_t ngx_http_write_filter(ngx_http
         }
     }
 
+    *ll = NULL;
+
     c = r->connection;
 
     ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0,
-                   "http write filter: l:%d f:" OFF_T_FMT " s:" OFF_T_FMT,
-                   last, flush, size);
+                   "http write filter: l:%d f:%O s:%O", last, flush, size);
 
     clcf = ngx_http_get_module_loc_conf(r->main ? r->main : r,
                                         ngx_http_core_module);
@@ -125,6 +142,9 @@ ngx_int_t ngx_http_write_filter(ngx_http
         if (!last) {
             ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
                           "the http output chain is empty");
+
+            ngx_debug_point();
+
             return NGX_ERROR;
         }
         return NGX_OK;
@@ -136,7 +156,7 @@ ngx_int_t ngx_http_write_filter(ngx_http
                           clcf->limit_rate ? clcf->limit_rate: OFF_T_MAX_VALUE);
 
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
-                   "http write filter %X", chain);
+                   "http write filter %p", chain);
 
     if (clcf->limit_rate) {
         sent = c->sent - sent;