comparison src/http/ngx_http_write_filter_module.c @ 76:da9a3b14312d NGINX_0_1_38

nginx 0.1.38 *) Feature: the "limit_rate" directive is supported in in proxy and FastCGI mode. *) Feature: the "X-Accel-Limit-Rate" response header line is supported in proxy and FastCGI mode. *) Feature: the "break" directive. *) Feature: the "log_not_found" directive. *) Bugfix: the response status code was not changed when request was redirected by the ""X-Accel-Redirect" header line. *) Bugfix: the variables set by the "set" directive could not be used in SSI. *) Bugfix: the segmentation fault may occurred if the SSI page has more than one remote subrequest. *) Bugfix: nginx treated the backend response as invalid if the status line in the header was transferred in two packets; bug appeared in 0.1.29. *) Feature: the "ssi_types" directive. *) Feature: the "autoindex_exact_size" directive. *) Bugfix: the ngx_http_autoindex_module did not support the long file names in UTF-8. *) Feature: the IMAP/POP3 proxy.
author Igor Sysoev <http://sysoev.ru>
date Fri, 08 Jul 2005 00:00:00 +0400
parents 0790a8599248
children 71c46860eb55
comparison
equal deleted inserted replaced
75:985847bb65f9 76:da9a3b14312d
44 off_t size, sent; 44 off_t size, sent;
45 ngx_uint_t last, flush; 45 ngx_uint_t last, flush;
46 ngx_chain_t *cl, *ln, **ll, *chain; 46 ngx_chain_t *cl, *ln, **ll, *chain;
47 ngx_connection_t *c; 47 ngx_connection_t *c;
48 ngx_http_core_loc_conf_t *clcf; 48 ngx_http_core_loc_conf_t *clcf;
49
50 c = r->connection;
51
52 if (c->closed) {
53 return NGX_ERROR;
54 }
49 55
50 size = 0; 56 size = 0;
51 flush = 0; 57 flush = 0;
52 last = 0; 58 last = 0;
53 ll = &r->out; 59 ll = &r->out;
149 } 155 }
150 } 156 }
151 157
152 *ll = NULL; 158 *ll = NULL;
153 159
154 c = r->connection;
155
156 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0, 160 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0,
157 "http write filter: l:%d f:%d s:%O", last, flush, size); 161 "http write filter: l:%d f:%d s:%O", last, flush, size);
158 162
159 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); 163 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
160 164
195 return NGX_ERROR; 199 return NGX_ERROR;
196 } 200 }
197 201
198 sent = c->sent; 202 sent = c->sent;
199 203
200 chain = c->send_chain(c, r->out, clcf->limit_rate); 204 chain = c->send_chain(c, r->out, r->limit_rate);
201 205
202 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, 206 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
203 "http write filter %p", chain); 207 "http write filter %p", chain);
204 208
205 if (clcf->limit_rate) { 209 if (r->limit_rate) {
206 sent = c->sent - sent; 210 sent = c->sent - sent;
207 c->write->delayed = 1; 211 c->write->delayed = 1;
208 ngx_add_timer(r->connection->write, 212 ngx_add_timer(r->connection->write,
209 (ngx_msec_t) (sent * 1000 / clcf->limit_rate)); 213 (ngx_msec_t) (sent * 1000 / r->limit_rate));
210 } 214 }
211 215
212 if (chain == NGX_CHAIN_ERROR) { 216 if (chain == NGX_CHAIN_ERROR) {
217 c->closed = 1;
213 return NGX_ERROR; 218 return NGX_ERROR;
214 } 219 }
215 220
216 for (cl = r->out; cl && cl != chain; /* void */) { 221 for (cl = r->out; cl && cl != chain; /* void */) {
217 ln = cl; 222 ln = cl;