diff options
author | Sergey Kandaurov <pluknet@nginx.com> | 2013-07-30 15:04:46 +0400 |
---|---|---|
committer | Sergey Kandaurov <pluknet@nginx.com> | 2013-07-30 15:04:46 +0400 |
commit | 0fea0bf3f7982348fd6ec9d14ebd946c783445b0 (patch) | |
tree | 185d65ce4f257a7b7c7ef57c0dcf2215f6562cd4 /src/http/ngx_http_core_module.c | |
parent | 2b2def789199b1fc661fbac38ff6bf7fdccb7bbb (diff) | |
download | nginx-0fea0bf3f7982348fd6ec9d14ebd946c783445b0.tar.gz nginx-0fea0bf3f7982348fd6ec9d14ebd946c783445b0.zip |
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.
Diffstat (limited to 'src/http/ngx_http_core_module.c')
-rw-r--r-- | src/http/ngx_http_core_module.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index ffe7fb4fe..47e5ff789 100644 --- 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_t *r, ngx_uint_t status, 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; |