How to handle NGX_AGAIN returned by ngx_http_read_client_request_body() within handler module?
CarlWang
nginx-forum at nginx.us
Tue Nov 8 04:31:04 UTC 2011
Here are my code:
static void v8_embed_handler ( ngx_http_request_t * r )
{
...// generating out chain.
rc = ngx_http_output_filter ( r , out );
while( rc == NGX_AGAIN ) {
if( out->next == NULL )
break;
rc = ngx_http_output_filter ( r , out->next );
out = out->next;
}
ngx_http_finalize_request ( r , rc );
}
static ngx_int_t ngx_http_v8_handler_request(ngx_http_request_t *r)
{
ngx_int_t rc = NGX_DONE ;
rc = ngx_http_read_client_request_body ( r , v8_embed_handler ) ; //
call the v8_embed_handler handler to process the post data
if ( rc >= NGX_HTTP_SPECIAL_RESPONSE )
return rc;
return NGX_DONE;
}
Then I changed the code as :
static void v8_embed_handler ( ngx_http_request_t * r )
{
...// generating out chain.
ngx_http_finalize_request ( r , ngx_http_output_filter ( r , out ) );
}
However, it doesn't change the test result. If the response is larger
than 64Kb, the problem is still there.
I'm using curl to test it. It firstly output 64k response and it says
"curl: (18) transfer closed with 19013 bytes remaining to read". Then it
output a little part of the remaining response. I don't really
understand why.
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,3545,217958#msg-217958
More information about the nginx
mailing list