diff options
author | Igor Sysoev <igor@sysoev.ru> | 2009-01-30 05:26:27 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2009-01-30 05:26:27 +0000 |
commit | 867d63bc1a0d9777d665c55774e7fde47c6471d3 (patch) | |
tree | 0b0232040ffb8db15792f9555a5d52f6ae7ad2aa /src/http/ngx_http_variables.c | |
parent | 9258872c2a028f121fcc7b7199e90334ad9466db (diff) | |
download | nginx-867d63bc1a0d9777d665c55774e7fde47c6471d3.tar.gz nginx-867d63bc1a0d9777d665c55774e7fde47c6471d3.zip |
fix $sent_http_location for local redirects
Diffstat (limited to 'src/http/ngx_http_variables.c')
-rw-r--r-- | src/http/ngx_http_variables.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c index 52584c3d3..98fef371b 100644 --- a/src/http/ngx_http_variables.c +++ b/src/http/ngx_http_variables.c @@ -69,6 +69,8 @@ static ngx_int_t ngx_http_variable_sent_content_type(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); static ngx_int_t ngx_http_variable_sent_content_length(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_http_variable_sent_location(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); static ngx_int_t ngx_http_variable_sent_last_modified(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); static ngx_int_t ngx_http_variable_sent_connection(ngx_http_request_t *r, @@ -210,6 +212,9 @@ static ngx_http_variable_t ngx_http_core_variables[] = { { ngx_string("sent_http_content_length"), NULL, ngx_http_variable_sent_content_length, 0, 0, 0 }, + { ngx_string("sent_http_location"), NULL, + ngx_http_variable_sent_location, 0, 0, 0 }, + { ngx_string("sent_http_last_modified"), NULL, ngx_http_variable_sent_last_modified, 0, 0, 0 }, @@ -1242,6 +1247,26 @@ ngx_http_variable_sent_content_length(ngx_http_request_t *r, static ngx_int_t +ngx_http_variable_sent_location(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +{ + if (r->headers_out.location) { + v->len = r->headers_out.location->value.len; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + v->data = r->headers_out.location->value.data; + + return NGX_OK; + } + + return ngx_http_variable_unknown_header(v, (ngx_str_t *) data, + &r->headers_out.headers.part, + sizeof("sent_http_") - 1); +} + + +static ngx_int_t ngx_http_variable_sent_last_modified(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data) { |