Welcome! Log In Create A New Profile

Advanced

Re: ngx_http_read_client_request_body not always being called?

Sergey Kandaurov
August 16, 2022 10:44AM
> On 16 Aug 2022, at 00:35, atrocitus <nginx-forum@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:
https://mailman.nginx.org/mailman3/lists/nginx-devel.nginx.org/

>
> 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
> r->main->count--;
> #endif
>
> //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:
http://nginx.org/en/docs/dev/development_guide.html#http_request_body

--
Sergey Kandaurov

_______________________________________________
nginx mailing list -- nginx@nginx.org
To unsubscribe send an email to nginx-leave@nginx.org
Subject Author Posted

ngx_http_read_client_request_body not always being called?

atrocitus August 15, 2022 04:35PM

Re: ngx_http_read_client_request_body not always being called?

Sergey Kandaurov August 16, 2022 10:44AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 96
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready