comparison 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
comparison
equal deleted inserted replaced
9:77eee314ddbd 10:46833bd150cb
67 /* find the size, the flush point and the last link of the saved chain */ 67 /* find the size, the flush point and the last link of the saved chain */
68 68
69 for (cl = ctx->out; cl; cl = cl->next) { 69 for (cl = ctx->out; cl; cl = cl->next) {
70 ll = &cl->next; 70 ll = &cl->next;
71 71
72 #if 1
73 if (ngx_buf_size(cl->buf) == 0 && !ngx_buf_special(cl->buf)) {
74 ngx_debug_point();
75 }
76 #endif
77
72 size += ngx_buf_size(cl->buf); 78 size += ngx_buf_size(cl->buf);
73 79
74 if (cl->buf->flush || cl->buf->recycled) { 80 if (cl->buf->flush || cl->buf->recycled) {
75 flush = size; 81 flush = size;
76 } 82 }
81 } 87 }
82 88
83 /* add the new chain to the existent one */ 89 /* add the new chain to the existent one */
84 90
85 for (ln = in; ln; ln = ln->next) { 91 for (ln = in; ln; ln = ln->next) {
86 ngx_alloc_link_and_set_buf(cl, ln->buf, r->pool, NGX_ERROR); 92 if (!(cl = ngx_alloc_chain_link(r->pool))) {
93 return NGX_ERROR;
94 }
95
96 cl->buf = ln->buf;
87 *ll = cl; 97 *ll = cl;
88 ll = &cl->next; 98 ll = &cl->next;
99
100 #if 1
101 if (ngx_buf_size(cl->buf) == 0 && !ngx_buf_special(cl->buf)) {
102 ngx_debug_point();
103 }
104 #endif
89 105
90 size += ngx_buf_size(cl->buf); 106 size += ngx_buf_size(cl->buf);
91 107
92 if (cl->buf->flush || cl->buf->recycled) { 108 if (cl->buf->flush || cl->buf->recycled) {
93 flush = size; 109 flush = size;
96 if (cl->buf->last_buf) { 112 if (cl->buf->last_buf) {
97 last = 1; 113 last = 1;
98 } 114 }
99 } 115 }
100 116
117 *ll = NULL;
118
101 c = r->connection; 119 c = r->connection;
102 120
103 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0, 121 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0,
104 "http write filter: l:%d f:" OFF_T_FMT " s:" OFF_T_FMT, 122 "http write filter: l:%d f:%O s:%O", last, flush, size);
105 last, flush, size);
106 123
107 clcf = ngx_http_get_module_loc_conf(r->main ? r->main : r, 124 clcf = ngx_http_get_module_loc_conf(r->main ? r->main : r,
108 ngx_http_core_module); 125 ngx_http_core_module);
109 126
110 /* 127 /*
123 140
124 if (size == 0 && !c->buffered) { 141 if (size == 0 && !c->buffered) {
125 if (!last) { 142 if (!last) {
126 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, 143 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
127 "the http output chain is empty"); 144 "the http output chain is empty");
145
146 ngx_debug_point();
147
128 return NGX_ERROR; 148 return NGX_ERROR;
129 } 149 }
130 return NGX_OK; 150 return NGX_OK;
131 } 151 }
132 152
134 154
135 chain = c->send_chain(c, ctx->out, 155 chain = c->send_chain(c, ctx->out,
136 clcf->limit_rate ? clcf->limit_rate: OFF_T_MAX_VALUE); 156 clcf->limit_rate ? clcf->limit_rate: OFF_T_MAX_VALUE);
137 157
138 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, 158 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
139 "http write filter %X", chain); 159 "http write filter %p", chain);
140 160
141 if (clcf->limit_rate) { 161 if (clcf->limit_rate) {
142 sent = c->sent - sent; 162 sent = c->sent - sent;
143 c->write->delayed = 1; 163 c->write->delayed = 1;
144 ngx_add_timer(r->connection->write, 164 ngx_add_timer(r->connection->write,