Function and description:
a. ngx_int_t ngx_http_read_client_request_body(ngx_http_request_t *r, ngx_http_client_body_handler_pt post_handler)
description:
This is the main function to read client request body.If your module need to read and process the request body, the function should be called.
b. static void
ngx_http_read_client_request_body_handler(ngx_http_request_t *r)
description:
This function is the r->read_event_handler . ngx_http_read_client_request_body mounted the ngx_http_read_client_request_body_handler . When the read event happened, it process the
event timeout and delay state.
c. static ngx_int_t
ngx_http_do_read_client_request_body(ngx_http_request_t *r)
description:
This function is responsible for read the body.
d. ngx_http_write_request_body
description:
This function write client request body in the temp file.
conf:
client_body_in_file_only on
| clean
| off
;
client_body_in_single_buffer on
| off
;
http://blog.csdn.net/russell_tao/article/details/5637545
ngx_http_read_client_request_body提供两种保存body的方式,一种是把body存储在内存中,另一种是把body存储到临时文件里。这个临时文件也有不同的处理方法,一种是请求结束后nginx便清理掉,另外就是永久保留这个临时文件。例如下面这两个参数就会设定为每个body都存放到临时文件里,并且这个临时文件在请求结束后不会被删除:
r->request_body_in_persistent_file = 1;
r->request_body_in_file_only = 1;
Preread introduction:
Preread judge if the client request body has been reading .
ngx_http_read_client_request_body provide the preread .
Mark:
May be this preread can not meet our needs.
https://github.com/cfsego/limit_upload_rate/blob/master/ngx_http_limit_upload_module.c is very useful.