comparison src/http/ngx_http_write_filter_module.c @ 330:c60beecc6ab5 NGINX_0_5_35

nginx 0.5.35 *) Change: now the ngx_http_userid_module adds start time microseconds to the cookie field contains a pid value. *) Change: now the uname(2) is used on Linux instead of procfs. Thanks to Ilya Novikov. *) Feature: the "If-Range" request header line support. Thanks to Alexander V. Inyukhin. *) Bugfix: in HTTPS mode requests might fail with the "bad write retry" error; bug appeared in 0.5.13. *) Bugfix: the STARTTLS in SMTP mode did not work. Thanks to Oleg Motienko. *) Bugfix: large_client_header_buffers did not freed before going to keep-alive state. Thanks to Olexander Shtepa. *) Bugfix: the "limit_rate" directive did not allow to use full throughput, even if limit value was very high. *) Bugfix: the $status variable was equal to 0 if a proxied server returned response in HTTP/0.9 version. *) Bugfix: if the "?" character was in a "error_page" directive, then it was escaped in a proxied request; bug appeared in 0.5.32.
author Igor Sysoev <http://sysoev.ru>
date Tue, 08 Jan 2008 00:00:00 +0300
parents 7cf404023f50
children
comparison
equal deleted inserted replaced
329:d792b2cd78fe 330:c60beecc6ab5
47 ngx_int_t 47 ngx_int_t
48 ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in) 48 ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in)
49 { 49 {
50 off_t size, sent, limit; 50 off_t size, sent, limit;
51 ngx_uint_t last, flush; 51 ngx_uint_t last, flush;
52 ngx_msec_t delay;
52 ngx_chain_t *cl, *ln, **ll, *chain; 53 ngx_chain_t *cl, *ln, **ll, *chain;
53 ngx_connection_t *c; 54 ngx_connection_t *c;
54 ngx_http_core_loc_conf_t *clcf; 55 ngx_http_core_loc_conf_t *clcf;
55 56
56 c = r->connection; 57 c = r->connection;
243 c->error = 1; 244 c->error = 1;
244 return NGX_ERROR; 245 return NGX_ERROR;
245 } 246 }
246 247
247 if (r->limit_rate) { 248 if (r->limit_rate) {
248 sent = c->sent - sent; 249 delay = (ngx_msec_t) ((c->sent - sent) * 1000 / r->limit_rate + 1);
249 c->write->delayed = 1; 250
250 ngx_add_timer(c->write, (ngx_msec_t) (sent * 1000 / r->limit_rate + 1)); 251 if (delay > 0) {
252 c->write->delayed = 1;
253 ngx_add_timer(c->write, delay);
254 }
251 255
252 } else if (c->write->ready 256 } else if (c->write->ready
253 && clcf->sendfile_max_chunk 257 && clcf->sendfile_max_chunk
254 && (size_t) (c->sent - sent) 258 && (size_t) (c->sent - sent)
255 >= clcf->sendfile_max_chunk - 2 * ngx_pagesize) 259 >= clcf->sendfile_max_chunk - 2 * ngx_pagesize)
256 { 260 {
257 c->write->delayed = 1; 261 c->write->delayed = 1;
258 ngx_add_timer(c->write, 1); 262 ngx_add_timer(c->write, 1);
259 } 263 }
260 264