diff options
| author | Ruslan Ermilov <ru@nginx.com> | 2016-12-22 11:58:52 +0300 |
|---|---|---|
| committer | Ruslan Ermilov <ru@nginx.com> | 2016-12-22 11:58:52 +0300 |
| commit | f02170672926e6afe273340fefb44bd1cc1d6ed4 (patch) | |
| tree | 73fab606ed909b5908874cf7132fcf6addbd5b8d /src | |
| parent | dd70e741970c841a1555911f6468b39870c0607b (diff) | |
| download | nginx-f02170672926e6afe273340fefb44bd1cc1d6ed4.tar.gz nginx-f02170672926e6afe273340fefb44bd1cc1d6ed4.tar.bz2 | |
Fixed missing "Location" field with some relative redirects.
Relative redirects did not work with directory redirects and
auto redirects issued by nginx.
Diffstat (limited to 'src')
| -rw-r--r-- | src/http/modules/ngx_http_dav_module.c | 9 | ||||
| -rw-r--r-- | src/http/modules/ngx_http_static_module.c | 9 | ||||
| -rw-r--r-- | src/http/ngx_http_core_module.c | 6 | ||||
| -rw-r--r-- | src/http/ngx_http_upstream.c | 4 |
4 files changed, 10 insertions, 18 deletions
diff --git a/src/http/modules/ngx_http_dav_module.c b/src/http/modules/ngx_http_dav_module.c index 012a0fba8..895a52dca 100644 --- a/src/http/modules/ngx_http_dav_module.c +++ b/src/http/modules/ngx_http_dav_module.c @@ -1067,7 +1067,7 @@ ngx_http_dav_location(ngx_http_request_t *r, u_char *path) 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_http_dav_location(ngx_http_request_t *r, u_char *path) 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; diff --git a/src/http/modules/ngx_http_static_module.c b/src/http/modules/ngx_http_static_module.c index f79c4aeee..07b95800d 100644 --- a/src/http/modules/ngx_http_static_module.c +++ b/src/http/modules/ngx_http_static_module.c @@ -150,7 +150,7 @@ ngx_http_static_handler(ngx_http_request_t *r) 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 @@ ngx_http_static_handler(ngx_http_request_t *r) } } - /* - * 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; diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index 685e72e4c..666d96fb3 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -983,10 +983,8 @@ ngx_http_core_find_config_phase(ngx_http_request_t *r, 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; diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index ed25f438d..d0bcd2907 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -4927,8 +4927,8 @@ ngx_http_upstream_rewrite_location(ngx_http_request_t *r, ngx_table_elt_t *h, } /* - * 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; |
