comparison src/http/ngx_http_request_body.c @ 532:f7ec98e3caeb NGINX_0_8_18

nginx 0.8.18 *) Feature: the "read_ahead" directive. *) Feature: now several "perl_modules" directive may be used. *) Feature: the "limit_req_log_level" and "limit_conn_log_level" directives. *) Bugfix: now "limit_req" directive conforms to the leaky bucket algorithm. Thanks to Maxim Dounin. *) Bugfix: nginx did not work on Linux/sparc. Thanks to Marcus Ramberg. *) Bugfix: nginx sent '\0' in a "Location" response header line on MKCOL request. Thanks to Xie Zhenye. *) Bugfix: zero status code was logged instead of 499 status code; the bug had appeared in 0.8.11. *) Bugfix: socket leak; the bug had appeared in 0.8.11.
author Igor Sysoev <http://sysoev.ru>
date Tue, 06 Oct 2009 00:00:00 +0400
parents 4c5d2c627a6c
children 1dcf6adad484
comparison
equal deleted inserted replaced
531:7688992d2abb 532:f7ec98e3caeb
467 r->headers_in.content_length_n = 0; 467 r->headers_in.content_length_n = 0;
468 return NGX_OK; 468 return NGX_OK;
469 } 469 }
470 } 470 }
471 471
472 r->discard_body = 1;
473
474 r->read_event_handler = ngx_http_read_discarded_request_body_handler; 472 r->read_event_handler = ngx_http_read_discarded_request_body_handler;
475 473
476 if (ngx_handle_read_event(rev, 0) != NGX_OK) { 474 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
477 return NGX_HTTP_INTERNAL_SERVER_ERROR; 475 return NGX_HTTP_INTERNAL_SERVER_ERROR;
478 } 476 }
479 477
480 if (ngx_http_read_discarded_request_body(r) != NGX_OK) { 478 if (ngx_http_read_discarded_request_body(r) == NGX_OK) {
479 r->lingering_close = 0;
480
481 } else {
481 r->count++; 482 r->count++;
483 r->discard_body = 1;
482 } 484 }
483 485
484 return NGX_OK; 486 return NGX_OK;
485 } 487 }
486 488
507 if (r->lingering_time) { 509 if (r->lingering_time) {
508 timer = (ngx_msec_t) (r->lingering_time - ngx_time()); 510 timer = (ngx_msec_t) (r->lingering_time - ngx_time());
509 511
510 if (timer <= 0) { 512 if (timer <= 0) {
511 r->discard_body = 0; 513 r->discard_body = 0;
514 r->lingering_close = 0;
512 ngx_http_finalize_request(r, 0); 515 ngx_http_finalize_request(r, 0);
513 return; 516 return;
514 } 517 }
515 518
516 } else { 519 } else {
520 rc = ngx_http_read_discarded_request_body(r); 523 rc = ngx_http_read_discarded_request_body(r);
521 524
522 if (rc == NGX_OK) { 525 if (rc == NGX_OK) {
523 526
524 r->discard_body = 0; 527 r->discard_body = 0;
528 r->lingering_close = 0;
525 529
526 if (r->done) { 530 if (r->done) {
527 ngx_http_finalize_request(r, 0); 531 ngx_http_finalize_request(r, 0);
528 } 532 }
529 533