[nginx] Autoindex: return NGX_ERROR on error if headers were sent.

Sergey Kandaurov pluknet at nginx.com
Wed Aug 21 16:24:35 UTC 2013


details:   http://hg.nginx.org/nginx/rev/1a9700ef9725
branches:  
changeset: 5332:1a9700ef9725
user:      Sergey Kandaurov <pluknet at nginx.com>
date:      Tue Jul 30 11:43:21 2013 +0400
description:
Autoindex: return NGX_ERROR on error if headers were sent.

This prevents ngx_http_finalize_request() from issuing
ngx_http_special_response_handler() on a freed context.

diffstat:

 src/http/modules/ngx_http_autoindex_module.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r e04083b79335 -r 1a9700ef9725 src/http/modules/ngx_http_autoindex_module.c
--- a/src/http/modules/ngx_http_autoindex_module.c	Tue Aug 20 21:33:43 2013 +0400
+++ b/src/http/modules/ngx_http_autoindex_module.c	Tue Jul 30 11:43:21 2013 +0400
@@ -388,7 +388,7 @@ ngx_http_autoindex_handler(ngx_http_requ
 
     b = ngx_create_temp_buf(r->pool, len);
     if (b == NULL) {
-        return NGX_HTTP_INTERNAL_SERVER_ERROR;
+        return NGX_ERROR;
     }
 
     if (entries.nelts > 1) {
@@ -649,7 +649,7 @@ ngx_http_autoindex_error(ngx_http_reques
                       ngx_close_dir_n " \"%V\" failed", name);
     }
 
-    return NGX_HTTP_INTERNAL_SERVER_ERROR;
+    return r->header_sent ? NGX_ERROR : NGX_HTTP_INTERNAL_SERVER_ERROR;
 }
 
 



More information about the nginx-devel mailing list