Skip to content

Commit

Permalink
Autoindex: return NGX_ERROR on error if headers were sent.
Browse files Browse the repository at this point in the history
This prevents ngx_http_finalize_request() from issuing
ngx_http_special_response_handler() on a freed context.
  • Loading branch information
pluknet committed Jul 30, 2013
1 parent 92f0126 commit eb3fed9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/http/modules/ngx_http_autoindex_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ ngx_http_autoindex_handler(ngx_http_request_t *r)

b = ngx_create_temp_buf(r->pool, len);
if (b == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
return NGX_ERROR;
}

if (entries.nelts > 1) {
Expand Down Expand Up @@ -649,7 +649,7 @@ ngx_http_autoindex_error(ngx_http_request_t *r, ngx_dir_t *dir, ngx_str_t *name)
ngx_close_dir_n " \"%V\" failed", name);
}

return NGX_HTTP_INTERNAL_SERVER_ERROR;
return r->header_sent ? NGX_ERROR : NGX_HTTP_INTERNAL_SERVER_ERROR;
}


Expand Down

0 comments on commit eb3fed9

Please sign in to comment.