ngx_http_read_client_request_body not always being called?
pluknet at nginx.com
Tue Aug 16 14:41:57 UTC 2022
> On 16 Aug 2022, at 00:35, atrocitus <nginx-forum at forum.nginx.org> wrote:
> (I wanted to post this to the Nginx Development group but it's read only)
You can subscribe to the nginx development mailing list:
> I'm developing a module which will receive post data then print out "Done".
> "Done" will be printed out regardless if it's a "POST" or a "GET". Issue I'm
> having is ngx_http_read_client_request_body is not always calling my call
> back, I have to wait a few seconds / resubmit form before it works. Is there
> a caching issue I'm not aware of? I'm doing this from bash command line, a
> simple CURL command.
> Here is what I have in my "cmd_handler":
> if (r->method == NGX_HTTP_POST)
> ngx_http_read_client_request_body(r, ngx_http_form_read)
> ngx_str_set(&r->headers_out.content_type, "text/html")
> ///....more out data definitions
> ngx_http_output_filter(r, out);
> ngx_http_finalize(request, r, NGX_DONE)
> return NGX_DONE
> In my ngx_http_form_read, I have the following:
> #if defined(ngx_version) && nginx_version >= 8011
> //form parsing data
> // no return, this is a void?
I see numerous issues in your code, including direct manipulation
with the request count and missing error handling.
See the complete example of handling request body:
More information about the nginx