Mercurial > hg > nginx
comparison src/http/ngx_http_write_filter_module.c @ 5042:9be045b4a415 stable-1.2
Merge of r4962: limit_rate fix.
Limit rate: fixed integer overflow in limit calculation (ticket #256).
Patch by Alexey Antropov.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sun, 10 Feb 2013 03:20:00 +0000 |
parents | a0f1d53546d4 |
children | 06fbbde04098 |
comparison
equal
deleted
inserted
replaced
5041:7a6fbac9f3e3 | 5042:9be045b4a415 |
---|---|
205 | 205 |
206 return NGX_ERROR; | 206 return NGX_ERROR; |
207 } | 207 } |
208 | 208 |
209 if (r->limit_rate) { | 209 if (r->limit_rate) { |
210 limit = r->limit_rate * (ngx_time() - r->start_sec + 1) | 210 limit = (off_t) r->limit_rate * (ngx_time() - r->start_sec + 1) |
211 - (c->sent - clcf->limit_rate_after); | 211 - (c->sent - clcf->limit_rate_after); |
212 | 212 |
213 if (limit <= 0) { | 213 if (limit <= 0) { |
214 c->write->delayed = 1; | 214 c->write->delayed = 1; |
215 ngx_add_timer(c->write, | 215 ngx_add_timer(c->write, |