Mercurial > hg > nginx
changeset 6853:c85dfd99a2dd
Fixed missing "Location" field with some relative redirects.
Relative redirects did not work with directory redirects and
auto redirects issued by nginx.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Thu, 22 Dec 2016 11:58:52 +0300 |
parents | d15172ebb400 |
children | 75e7d55214bd |
files | src/http/modules/ngx_http_dav_module.c src/http/modules/ngx_http_static_module.c src/http/ngx_http_core_module.c src/http/ngx_http_upstream.c |
diffstat | 4 files changed, 10 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_dav_module.c Wed Dec 21 23:10:51 2016 +0300 +++ b/src/http/modules/ngx_http_dav_module.c Thu Dec 22 11:58:52 2016 +0300 @@ -1067,7 +1067,7 @@ u_char *location; ngx_http_core_loc_conf_t *clcf; - r->headers_out.location = ngx_palloc(r->pool, sizeof(ngx_table_elt_t)); + r->headers_out.location = ngx_list_push(&r->headers_out.headers); if (r->headers_out.location == NULL) { return NGX_ERROR; } @@ -1086,11 +1086,8 @@ ngx_memcpy(location, r->uri.data, r->uri.len); } - /* - * we do not need to set the r->headers_out.location->hash and - * r->headers_out.location->key fields - */ - + r->headers_out.location->hash = 1; + ngx_str_set(&r->headers_out.location->key, "Location"); r->headers_out.location->value.len = r->uri.len; r->headers_out.location->value.data = location;
--- a/src/http/modules/ngx_http_static_module.c Wed Dec 21 23:10:51 2016 +0300 +++ b/src/http/modules/ngx_http_static_module.c Thu Dec 22 11:58:52 2016 +0300 @@ -150,7 +150,7 @@ ngx_http_clear_location(r); - r->headers_out.location = ngx_palloc(r->pool, sizeof(ngx_table_elt_t)); + r->headers_out.location = ngx_list_push(&r->headers_out.headers); if (r->headers_out.location == NULL) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } @@ -182,11 +182,8 @@ } } - /* - * we do not need to set the r->headers_out.location->hash and - * r->headers_out.location->key fields - */ - + r->headers_out.location->hash = 1; + ngx_str_set(&r->headers_out.location->key, "Location"); r->headers_out.location->value.len = len; r->headers_out.location->value.data = location;
--- a/src/http/ngx_http_core_module.c Wed Dec 21 23:10:51 2016 +0300 +++ b/src/http/ngx_http_core_module.c Thu Dec 22 11:58:52 2016 +0300 @@ -983,10 +983,8 @@ return NGX_OK; } - /* - * we do not need to set the r->headers_out.location->hash and - * r->headers_out.location->key fields - */ + r->headers_out.location->hash = 1; + ngx_str_set(&r->headers_out.location->key, "Location"); if (r->args.len == 0) { r->headers_out.location->value = clcf->name;
--- a/src/http/ngx_http_upstream.c Wed Dec 21 23:10:51 2016 +0300 +++ b/src/http/ngx_http_upstream.c Thu Dec 22 11:58:52 2016 +0300 @@ -4927,8 +4927,8 @@ } /* - * we do not set r->headers_out.location here to avoid the handling - * the local redirects without a host name by ngx_http_header_filter() + * we do not set r->headers_out.location here to avoid handling + * relative redirects in ngx_http_header_filter() */ return NGX_OK;