Mercurial > hg > nginx-vendor-1-0
diff src/http/ngx_http_variables.c @ 442:670af56a1158 NGINX_0_7_33
nginx 0.7.33
*) Bugfix: a double response might be returned if the epoll or rtsig
methods are used and a redirect was returned to a request with
body.
Thanks to Eden Li.
*) Bugfix: the $sent_http_location variable was empty for some
redirects types.
*) Bugfix: a segmentation fault might occur in worker process if
"resolver" directive was used in SMTP proxy.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 02 Feb 2009 00:00:00 +0300 |
parents | fd759445d8a8 |
children | 76a79816b771 |
line wrap: on
line diff
--- 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_ 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_cor { 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(ng 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) {