aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_core_module.c
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2011-10-12 13:28:03 +0000
committerMaxim Dounin <mdounin@mdounin.ru>2011-10-12 13:28:03 +0000
commit72df0f400a4f6144f9c69add91002a0ff02cfe41 (patch)
tree7956765c5ca64545280611b6843595d7e45e019d /src/http/ngx_http_core_module.c
parent8650c1eb24f77773f04df3ed358897c39334a1bc (diff)
downloadnginx-72df0f400a4f6144f9c69add91002a0ff02cfe41.tar.gz
nginx-72df0f400a4f6144f9c69add91002a0ff02cfe41.zip
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.
Diffstat (limited to 'src/http/ngx_http_core_module.c')
-rw-r--r--src/http/ngx_http_core_module.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 22f5bdff2..b94376236 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -983,6 +983,8 @@ ngx_http_core_find_config_phase(ngx_http_request_t *r,
}
if (rc == NGX_DONE) {
+ ngx_http_clear_location(r);
+
r->headers_out.location = ngx_list_push(&r->headers_out.headers);
if (r->headers_out.location == NULL) {
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
@@ -1796,6 +1798,8 @@ ngx_http_send_response(ngx_http_request_t *r, ngx_uint_t status,
if (status >= NGX_HTTP_MOVED_PERMANENTLY && status <= NGX_HTTP_SEE_OTHER) {
+ ngx_http_clear_location(r);
+
r->headers_out.location = ngx_list_push(&r->headers_out.headers);
if (r->headers_out.location == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;