comparison src/http/ngx_http_core_module.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 657aaedcc0e3
children c8f6248566aa
comparison
equal deleted inserted replaced
4205:26c307b8dc3c 4206:1a94a56a4e5d
981 ngx_http_finalize_request(r, NGX_HTTP_REQUEST_ENTITY_TOO_LARGE); 981 ngx_http_finalize_request(r, NGX_HTTP_REQUEST_ENTITY_TOO_LARGE);
982 return NGX_OK; 982 return NGX_OK;
983 } 983 }
984 984
985 if (rc == NGX_DONE) { 985 if (rc == NGX_DONE) {
986 ngx_http_clear_location(r);
987
986 r->headers_out.location = ngx_list_push(&r->headers_out.headers); 988 r->headers_out.location = ngx_list_push(&r->headers_out.headers);
987 if (r->headers_out.location == NULL) { 989 if (r->headers_out.location == NULL) {
988 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); 990 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
989 return NGX_OK; 991 return NGX_OK;
990 } 992 }
1793 if (ngx_http_complex_value(r, cv, &val) != NGX_OK) { 1795 if (ngx_http_complex_value(r, cv, &val) != NGX_OK) {
1794 return NGX_HTTP_INTERNAL_SERVER_ERROR; 1796 return NGX_HTTP_INTERNAL_SERVER_ERROR;
1795 } 1797 }
1796 1798
1797 if (status >= NGX_HTTP_MOVED_PERMANENTLY && status <= NGX_HTTP_SEE_OTHER) { 1799 if (status >= NGX_HTTP_MOVED_PERMANENTLY && status <= NGX_HTTP_SEE_OTHER) {
1800
1801 ngx_http_clear_location(r);
1798 1802
1799 r->headers_out.location = ngx_list_push(&r->headers_out.headers); 1803 r->headers_out.location = ngx_list_push(&r->headers_out.headers);
1800 if (r->headers_out.location == NULL) { 1804 if (r->headers_out.location == NULL) {
1801 return NGX_HTTP_INTERNAL_SERVER_ERROR; 1805 return NGX_HTTP_INTERNAL_SERVER_ERROR;
1802 } 1806 }