comparison src/http/ngx_http_core_module.c @ 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 314c3d7cc3a5
children ee2a4c68fb35
comparison
equal deleted inserted replaced
5333:e8bca8397625 5334:03ff14058272
1931 1931
1932 1932
1933 ngx_int_t 1933 ngx_int_t
1934 ngx_http_send_header(ngx_http_request_t *r) 1934 ngx_http_send_header(ngx_http_request_t *r)
1935 { 1935 {
1936 if (r->header_sent) {
1937 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
1938 "header already sent");
1939 return NGX_ERROR;
1940 }
1941
1936 if (r->err_status) { 1942 if (r->err_status) {
1937 r->headers_out.status = r->err_status; 1943 r->headers_out.status = r->err_status;
1938 r->headers_out.status_line.len = 0; 1944 r->headers_out.status_line.len = 0;
1939 } 1945 }
1940 1946