comparison src/http/modules/ngx_http_range_filter_module.c @ 4060:45de8d258085

*) fix of r4060: start value should be tested after the "found" label; *) optimization: start value may be tested against end value only, since end value here may not be greater than content_length.
author Igor Sysoev <igor@sysoev.ru>
date Tue, 30 Aug 2011 20:34:58 +0000
parents cc72e6229416
children bd2ec6ce5d58
comparison
equal deleted inserted replaced
4059:cc72e6229416 4060:45de8d258085
293 if (suffix) { 293 if (suffix) {
294 start = content_length - end; 294 start = content_length - end;
295 end = content_length - 1; 295 end = content_length - 1;
296 } 296 }
297 297
298 if (start >= content_length || start > end) {
299 goto skip;
300 }
301
302 if (end >= content_length) { 298 if (end >= content_length) {
303 end = content_length; 299 end = content_length;
304 300
305 } else { 301 } else {
306 end++; 302 end++;
307 } 303 }
308 304
309 found: 305 found:
310 306
311 range = ngx_array_push(&ctx->ranges); 307 if (start < end) {
312 if (range == NULL) { 308 range = ngx_array_push(&ctx->ranges);
313 return NGX_ERROR; 309 if (range == NULL) {
314 } 310 return NGX_ERROR;
315 311 }
316 range->start = start; 312
317 range->end = end; 313 range->start = start;
318 314 range->end = end;
319 size += end - start; 315
320 316 size += end - start;
321 skip: 317 }
322 318
323 if (*p++ != ',') { 319 if (*p++ != ',') {
324 break; 320 break;
325 } 321 }
326 } 322 }