ngx_http_send_response is not sending big buffer

Maxim Dounin mdounin at mdounin.ru
Fri Apr 6 09:09:12 UTC 2012


Hello!

On Fri, Apr 06, 2012 at 12:56:56PM +0530, vivek goel wrote:

> I forgot to mention line ngx_http_send_response
> Sudo Code for ProccessNginxRequest is like this
> ngx_str_set(&cv->value,"A BIG STRING OF LENGTH 401481")
> ngx_http_send_response(r, NGX_HTTP_OK, &ngx_http_json_type, cv);
> 
> regards
> Vivek Goel
> 
> 
> 
> On Fri, Apr 6, 2012 at 12:55 PM, vivek goel <goelvivek2011 at gmail.com> wrote:
> 
> > I am writing my own module.
> > I am getting error with function ngx_http_send_response it is not sending
> > complete buffer if buffer is big.
> >
> > I have following code
> >
> >   ngx_http_complex_value_t cv;
> >  ngx_int_t rc = ProcessNginxRequest(r, &cv);
> >  ngx_http_finalize_request(r, NGX_HTTP_OK);
> > return rc;
> >
> > Sudo Code for ProccessNginxRequest is like this
> > ngx_str_set(&cv->value,"A BIG STRING OF LENGTH 401481")
> >
> > But response coming from the server is truncated.
> > How to fix this problem ?

Parts of code you've provided suggests you do 2 extra request 
finalizations.

Correct usage of ngx_http_send_response() in a handler function 
is:

    return ngx_http_send_response(r, NGX_HTTP_OK, &ngx_http_json_type, &cv);

Maxim Dounin



More information about the nginx-devel mailing list