comparison src/http/ngx_http_request_body.c @ 5210:ea2ba6dbe361

Fixed lingering_time check. There are two significant changes in this patch: 1) The <= 0 comparison is done with a signed type. This fixes the case of ngx_time() being larger than r->lingering_time. 2) Calculation of r->lingering_time - ngx_time() is now always done in the ngx_msec_t type. This ensures the calculation is correct even if time_t is unsigned and differs in size from ngx_msec_t. Thanks to Lanshun Zhou.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 13 May 2013 17:39:45 +0400
parents 3494f14aa46a
children 2fda9065d0f4
comparison
equal deleted inserted replaced
5209:07e515e65984 5210:ea2ba6dbe361
568 ngx_http_finalize_request(r, NGX_ERROR); 568 ngx_http_finalize_request(r, NGX_ERROR);
569 return; 569 return;
570 } 570 }
571 571
572 if (r->lingering_time) { 572 if (r->lingering_time) {
573 timer = (ngx_msec_t) (r->lingering_time - ngx_time()); 573 timer = (ngx_msec_t) r->lingering_time - (ngx_msec_t) ngx_time();
574 574
575 if (timer <= 0) { 575 if ((ngx_msec_int_t) timer <= 0) {
576 r->discard_body = 0; 576 r->discard_body = 0;
577 r->lingering_close = 0; 577 r->lingering_close = 0;
578 ngx_http_finalize_request(r, NGX_ERROR); 578 ngx_http_finalize_request(r, NGX_ERROR);
579 return; 579 return;
580 } 580 }