comparison src/http/modules/ngx_http_autoindex_module.c @ 5414:5fa350899fe0 stable-1.4

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.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 30 Jul 2013 11:43:21 +0400
parents e9d188e295cf
children f7e8e6bd5379
comparison
equal deleted inserted replaced
5413:bd91997a1117 5414:5fa350899fe0
386 + 2; 386 + 2;
387 } 387 }
388 388
389 b = ngx_create_temp_buf(r->pool, len); 389 b = ngx_create_temp_buf(r->pool, len);
390 if (b == NULL) { 390 if (b == NULL) {
391 return NGX_HTTP_INTERNAL_SERVER_ERROR; 391 return NGX_ERROR;
392 } 392 }
393 393
394 if (entries.nelts > 1) { 394 if (entries.nelts > 1) {
395 ngx_qsort(entry, (size_t) entries.nelts, 395 ngx_qsort(entry, (size_t) entries.nelts,
396 sizeof(ngx_http_autoindex_entry_t), 396 sizeof(ngx_http_autoindex_entry_t),
647 if (ngx_close_dir(dir) == NGX_ERROR) { 647 if (ngx_close_dir(dir) == NGX_ERROR) {
648 ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno, 648 ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno,
649 ngx_close_dir_n " \"%V\" failed", name); 649 ngx_close_dir_n " \"%V\" failed", name);
650 } 650 }
651 651
652 return NGX_HTTP_INTERNAL_SERVER_ERROR; 652 return r->header_sent ? NGX_ERROR : NGX_HTTP_INTERNAL_SERVER_ERROR;
653 } 653 }
654 654
655 655
656 static void * 656 static void *
657 ngx_http_autoindex_create_loc_conf(ngx_conf_t *cf) 657 ngx_http_autoindex_create_loc_conf(ngx_conf_t *cf)