comparison src/http/ngx_http_request_body.c @ 3213:7fc06314c684

fix ngx_http_finalize_request() code after a body has been discarded
author Igor Sysoev <igor@sysoev.ru>
date Mon, 19 Oct 2009 16:06:57 +0000
parents e67d000b5337
children 798a7f1d3b2f
comparison
equal deleted inserted replaced
3212:e67d000b5337 3213:7fc06314c684
501 rev = c->read; 501 rev = c->read;
502 502
503 if (rev->timedout) { 503 if (rev->timedout) {
504 c->timedout = 1; 504 c->timedout = 1;
505 c->error = 1; 505 c->error = 1;
506 ngx_http_finalize_request(r, 0); 506 ngx_http_finalize_request(r, NGX_ERROR);
507 return; 507 return;
508 } 508 }
509 509
510 if (r->lingering_time) { 510 if (r->lingering_time) {
511 timer = (ngx_msec_t) (r->lingering_time - ngx_time()); 511 timer = (ngx_msec_t) (r->lingering_time - ngx_time());
512 512
513 if (timer <= 0) { 513 if (timer <= 0) {
514 r->discard_body = 0; 514 r->discard_body = 0;
515 r->lingering_close = 0; 515 r->lingering_close = 0;
516 ngx_http_finalize_request(r, 0); 516 ngx_http_finalize_request(r, NGX_ERROR);
517 return; 517 return;
518 } 518 }
519 519
520 } else { 520 } else {
521 timer = 0; 521 timer = 0;
522 } 522 }
523 523
524 rc = ngx_http_read_discarded_request_body(r); 524 rc = ngx_http_read_discarded_request_body(r);
525 525
526 if (rc == NGX_OK) { 526 if (rc == NGX_OK) {
527
528 r->discard_body = 0; 527 r->discard_body = 0;
529 r->lingering_close = 0; 528 r->lingering_close = 0;
530 529 ngx_http_finalize_request(r, NGX_DONE);
531 if (r->done) {
532 ngx_http_finalize_request(r, 0);
533 }
534
535 return; 530 return;
536 } 531 }
537 532
538 /* rc == NGX_AGAIN */ 533 /* rc == NGX_AGAIN */
539 534
540 if (ngx_handle_read_event(rev, 0) != NGX_OK) { 535 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
541 c->error = 1; 536 c->error = 1;
542 ngx_http_finalize_request(r, rc); 537 ngx_http_finalize_request(r, NGX_ERROR);
543 return; 538 return;
544 } 539 }
545 540
546 if (timer) { 541 if (timer) {
547 542