comparison src/http/ngx_http_request_body.c @ 4924:caca5603bded

Request body: properly handle events while discarding body. An attempt to call ngx_handle_read_event() before actually reading data from a socket might result in read event being disabled, which is wrong. Catched by body.t test on Solaris.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 21 Nov 2012 00:57:56 +0000
parents 57174af2e695
children 6f085bfcdb4d
comparison
equal deleted inserted replaced
4923:57174af2e695 4924:caca5603bded
480 r->headers_in.content_length_n = 0; 480 r->headers_in.content_length_n = 0;
481 return NGX_OK; 481 return NGX_OK;
482 } 482 }
483 } 483 }
484 484
485 if (ngx_http_read_discarded_request_body(r) == NGX_OK) {
486 r->lingering_close = 0;
487 return NGX_OK;
488 }
489
490 /* == NGX_AGAIN */
491
485 r->read_event_handler = ngx_http_discarded_request_body_handler; 492 r->read_event_handler = ngx_http_discarded_request_body_handler;
486 493
487 if (ngx_handle_read_event(rev, 0) != NGX_OK) { 494 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
488 return NGX_HTTP_INTERNAL_SERVER_ERROR; 495 return NGX_HTTP_INTERNAL_SERVER_ERROR;
489 } 496 }
490 497
491 if (ngx_http_read_discarded_request_body(r) == NGX_OK) { 498 r->count++;
492 r->lingering_close = 0; 499 r->discard_body = 1;
493
494 } else {
495 r->count++;
496 r->discard_body = 1;
497 }
498 500
499 return NGX_OK; 501 return NGX_OK;
500 } 502 }
501 503
502 504