Mercurial > hg > nginx
changeset 5334:03ff14058272
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.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 30 Jul 2013 15:04:46 +0400 |
parents | e8bca8397625 |
children | 1d0523f54a9f |
files | src/http/ngx_http_core_module.c |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c Tue Jul 30 11:43:21 2013 +0400 +++ b/src/http/ngx_http_core_module.c Tue Jul 30 15:04:46 2013 +0400 @@ -1933,6 +1933,12 @@ 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;