comparison src/http/ngx_http_script.c @ 4206:1a94a56a4e5d

Clear old Location header (if any) while adding a new one. This prevents incorrect behaviour when another redirect is issued within error_page 302 handler.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 12 Oct 2011 13:28:03 +0000
parents 77f667dd0504
children d620f497c50f
comparison
equal deleted inserted replaced
4205:26c307b8dc3c 4206:1a94a56a4e5d
1104 if (e->log || (r->connection->log->log_level & NGX_LOG_DEBUG_HTTP)) { 1104 if (e->log || (r->connection->log->log_level & NGX_LOG_DEBUG_HTTP)) {
1105 ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0, 1105 ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0,
1106 "rewritten redirect: \"%V\"", &e->buf); 1106 "rewritten redirect: \"%V\"", &e->buf);
1107 } 1107 }
1108 1108
1109 ngx_http_clear_location(r);
1110
1109 r->headers_out.location = ngx_list_push(&r->headers_out.headers); 1111 r->headers_out.location = ngx_list_push(&r->headers_out.headers);
1110 if (r->headers_out.location == NULL) { 1112 if (r->headers_out.location == NULL) {
1111 e->ip = ngx_http_script_exit; 1113 e->ip = ngx_http_script_exit;
1112 e->status = NGX_HTTP_INTERNAL_SERVER_ERROR; 1114 e->status = NGX_HTTP_INTERNAL_SERVER_ERROR;
1113 return; 1115 return;