[PATCH]Upstream: avoided directly terminating the connection.

Maxim Dounin mdounin at mdounin.ru
Mon Sep 8 23:34:29 UTC 2014


Hello!

On Wed, Aug 13, 2014 at 03:03:52PM +0800, flygoast wrote:

> # HG changeset patch
> # User FengGu <flygoast at 126.com>
> # Date 1407912835 -28800
> #      Wed Aug 13 14:53:55 2014 +0800
> # Node ID 9dd4e38fcce05bcbba4747873a579bc2c9392dd2
> # Parent  92490a725fef588939abfe0e1fe89cda0788d02d
> Upstream: avoided directly terminating the connection.
> 
> 
> When memory allocation failed in ngx_http_upstream_cache(), the connection
> would be terminated directly in ngx_http_upstream_init_request().
> Return a INTERNAL_SERVER_ERROR response instead.
> 
> 
> diff -r 92490a725fef -r 9dd4e38fcce0 src/http/ngx_http_upstream.c
> --- a/src/http/ngx_http_upstream.c  Sun Aug 10 17:44:46 2014 +0400
> +++ b/src/http/ngx_http_upstream.c  Wed Aug 13 14:53:55 2014 +0800
> @@ -519,6 +519,11 @@ ngx_http_upstream_init_request(ngx_http_
>              return;
>          }
> 
> 
> +        if (rc == NGX_ERROR) {
> +            ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
> +            return;
> +        }
> +
>          if (rc != NGX_DECLINED) {
>              ngx_http_finalize_request(r, rc);
>              return;

Committed, thanks.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx-devel mailing list