Mercurial > hg > nginx-quic
changeset 5901:7d7eac6e31df
Upstream: support named location for X-Accel-Redirect.
author | Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp> |
---|---|
date | Tue, 04 Nov 2014 19:56:23 +0900 |
parents | 20d966ad5e89 |
children | b7a37f6a25ea |
files | src/http/ngx_http_upstream.c |
diffstat | 1 files changed, 20 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -2218,19 +2218,26 @@ ngx_http_upstream_process_headers(ngx_ht } uri = u->headers_in.x_accel_redirect->value; - ngx_str_null(&args); - flags = NGX_HTTP_LOG_UNSAFE; - - if (ngx_http_parse_unsafe_uri(r, &uri, &args, &flags) != NGX_OK) { - ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND); - return NGX_DONE; - } - - if (r->method != NGX_HTTP_HEAD) { - r->method = NGX_HTTP_GET; - } - - ngx_http_internal_redirect(r, &uri, &args); + + if (uri.data[0] == '@') { + ngx_http_named_location(r, &uri); + + } else { + ngx_str_null(&args); + flags = NGX_HTTP_LOG_UNSAFE; + + if (ngx_http_parse_unsafe_uri(r, &uri, &args, &flags) != NGX_OK) { + ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND); + return NGX_DONE; + } + + if (r->method != NGX_HTTP_HEAD) { + r->method = NGX_HTTP_GET; + } + + ngx_http_internal_redirect(r, &uri, &args); + } + ngx_http_finalize_request(r, NGX_DONE); return NGX_DONE; }