Reading large request body using ngx_http_read_client_request_body

NginxNewbee nginx-forum at forum.nginx.org
Mon May 20 20:35:51 UTC 2019


Thanks. Your understanding is correct. For cases, when
ngx_http_read_client_request_body returns NGX_AGAIN, thread returns and
request will get finalized. I'll go ahead and move reading contents of r and
request body to main thread in the content handler and just keep execution
of our business logic on thread.

Just one more question - Once I move ngx_http_read_client_request_body  in
content handler on main thread and it returns NGX_AGAIN, how should I handle
it? Code sample on nginx developer reference, recommends this.

ngx_int_t
ngx_http_foo_content_handler(ngx_http_request_t *r)
{
    ngx_int_t  rc;

    rc = ngx_http_read_client_request_body(r, ngx_http_foo_init);

    if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
        /* error */
        return rc;
    }

    return NGX_DONE;
}

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,284214,284224#msg-284224



More information about the nginx mailing list