# HG changeset patch # User Sergey Kandaurov # Date 1375182286 -14400 # Node ID 03ff140582729a2b35cee7c235bf025cb0f97525 # Parent e8bca839762561e34c7c36f5b5398fe361e5cd82 Added safety belt for the case of sending header twice. The aforementioned situation is abnormal per se and as such it now forces request termination with appropriate error message. diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -1933,6 +1933,12 @@ ngx_http_send_response(ngx_http_request_ ngx_int_t ngx_http_send_header(ngx_http_request_t *r) { + if (r->header_sent) { + ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, + "header already sent"); + return NGX_ERROR; + } + if (r->err_status) { r->headers_out.status = r->err_status; r->headers_out.status_line.len = 0;