Mercurial > hg > nginx
comparison src/http/ngx_http_request_body.c @ 1370:cc114c85be0f
rename ngx_http_discard_body() to ngx_http_discard_request_body()
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 06 Aug 2007 15:37:22 +0000 |
parents | 6254b90eea4b |
children | fdea12ffb24a |
comparison
equal
deleted
inserted
replaced
1369:6254b90eea4b | 1370:cc114c85be0f |
---|---|
12 | 12 |
13 static void ngx_http_read_client_request_body_handler(ngx_http_request_t *r); | 13 static void ngx_http_read_client_request_body_handler(ngx_http_request_t *r); |
14 static ngx_int_t ngx_http_do_read_client_request_body(ngx_http_request_t *r); | 14 static ngx_int_t ngx_http_do_read_client_request_body(ngx_http_request_t *r); |
15 static ngx_int_t ngx_http_write_request_body(ngx_http_request_t *r, | 15 static ngx_int_t ngx_http_write_request_body(ngx_http_request_t *r, |
16 ngx_chain_t *body); | 16 ngx_chain_t *body); |
17 static void ngx_http_read_discarded_body_handler(ngx_http_request_t *r); | 17 static void ngx_http_read_discarded_request_body_handler(ngx_http_request_t *r); |
18 static ngx_int_t ngx_http_read_discarded_body(ngx_http_request_t *r); | 18 static ngx_int_t ngx_http_read_discarded_request_body(ngx_http_request_t *r); |
19 | 19 |
20 | 20 |
21 /* | 21 /* |
22 * on completion ngx_http_read_client_request_body() adds to | 22 * on completion ngx_http_read_client_request_body() adds to |
23 * r->request_body->bufs one or two bufs: | 23 * r->request_body->bufs one or two bufs: |
423 return NGX_OK; | 423 return NGX_OK; |
424 } | 424 } |
425 | 425 |
426 | 426 |
427 ngx_int_t | 427 ngx_int_t |
428 ngx_http_discard_body(ngx_http_request_t *r) | 428 ngx_http_discard_request_body(ngx_http_request_t *r) |
429 { | 429 { |
430 ssize_t size; | 430 ssize_t size; |
431 ngx_event_t *rev; | 431 ngx_event_t *rev; |
432 | 432 |
433 if (r != r->main || r->discard_body) { | 433 if (r != r->main || r->discard_body) { |
459 r->headers_in.content_length_n = 0; | 459 r->headers_in.content_length_n = 0; |
460 return NGX_OK; | 460 return NGX_OK; |
461 } | 461 } |
462 } | 462 } |
463 | 463 |
464 r->read_event_handler = ngx_http_read_discarded_body_handler; | 464 r->read_event_handler = ngx_http_read_discarded_request_body_handler; |
465 | 465 |
466 if (ngx_handle_read_event(rev, 0) == NGX_ERROR) { | 466 if (ngx_handle_read_event(rev, 0) == NGX_ERROR) { |
467 return NGX_HTTP_INTERNAL_SERVER_ERROR; | 467 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
468 } | 468 } |
469 | 469 |
470 return ngx_http_read_discarded_body(r); | 470 return ngx_http_read_discarded_request_body(r); |
471 } | 471 } |
472 | 472 |
473 | 473 |
474 static void | 474 static void |
475 ngx_http_read_discarded_body_handler(ngx_http_request_t *r) | 475 ngx_http_read_discarded_request_body_handler(ngx_http_request_t *r) |
476 { | 476 { |
477 ngx_int_t rc; | 477 ngx_int_t rc; |
478 | 478 |
479 rc = ngx_http_read_discarded_body(r); | 479 rc = ngx_http_read_discarded_request_body(r); |
480 | 480 |
481 if (rc == NGX_AGAIN) { | 481 if (rc == NGX_AGAIN) { |
482 if (ngx_handle_read_event(r->connection->read, 0) == NGX_ERROR) { | 482 if (ngx_handle_read_event(r->connection->read, 0) == NGX_ERROR) { |
483 ngx_http_finalize_request(r, rc); | 483 ngx_http_finalize_request(r, rc); |
484 return; | 484 return; |
490 } | 490 } |
491 } | 491 } |
492 | 492 |
493 | 493 |
494 static ngx_int_t | 494 static ngx_int_t |
495 ngx_http_read_discarded_body(ngx_http_request_t *r) | 495 ngx_http_read_discarded_request_body(ngx_http_request_t *r) |
496 { | 496 { |
497 size_t size; | 497 size_t size; |
498 ssize_t n; | 498 ssize_t n; |
499 u_char buffer[NGX_HTTP_DISCARD_BUFFER_SIZE]; | 499 u_char buffer[NGX_HTTP_DISCARD_BUFFER_SIZE]; |
500 | 500 |