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

Maxim Dounin mdounin at mdounin.ru
Fri Jun 27 19:41:59 UTC 2014


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/



More information about the nginx mailing list