[PROPOSAL PATCH] use a return code for ngx_http_close_request()

crespin nginx-forum at nginx.us
Sat Jun 28 10:54:14 UTC 2014


Maxim Dounin Wrote:
-------------------------------------------------------
> Hello!
> 
> On Fri, Jun 27, 2014 at 09:26:23AM -0400, crespin wrote:
> 
> > Hello,
> > 
> > here is another path still on ngx_http_request.c.
> > In function ngx_http_close_request(), the second parameter is an
> error
> > code.
> > 
> > This error code is used in ngx_http_free_request() to set the HTTP
> status
> > code if it's not present or if no bytes are already sent.
> > 
> > Use NGX_OK instead of zero seems - for me - valid.
> 
> The same logic applies as in the previous answer about 
> ngx_http_terminate_request().
> 
> > When ngx_http_close_request() is called after an error, I guess it's
> must be
> > NGX_HTTP_INTERNAL_SERVER_ERROR.
> > 
> > Perhaps, it's better to do two patch one for zero to NGX_OK and
> another for 
> > NGX_HTTP_INTERNAL_SERVER_ERROR.
> 
> Use of NGX_HTTP_INTERNAL_SERVER_ERROR is wrong, as there are no 
> chances that this response code will be ever actually sent.  
> Response headers are either already sent, or won't be sent at all.
> 
> -- 
> Maxim Dounin
> http://nginx.org/
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

Hello Maxim,

Thanks for your response.

ngx_hhtp_close_request() call ngx_http_free_request()
Reading the code with your comments, rc is only set when a timeout is
raised.
Is it right ?
So the parameter can be a flag ngx_flag_t is_timeout ?

yves

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,251228,251281#msg-251281



More information about the nginx mailing list