diff options
author | Igor Sysoev <igor@sysoev.ru> | 2007-07-30 09:15:47 +0000 |
---|---|---|
committer | Jonathan Kolb <jon@b0g.us> | 2007-07-30 09:15:47 +0000 |
commit | ad5526a0773dea7fca82cca22433e2cb0b327837 (patch) | |
tree | 83f8ffae019ea0d39633c2c5520b3dfa6cfd47d2 /src/http/ngx_http_variables.c | |
parent | b9b71bc11c42dce8b014ee3cf3a1f5dc7b9ecc2f (diff) | |
download | nginx-ad5526a0773dea7fca82cca22433e2cb0b327837.tar.gz |
Changes with nginx 0.6.6 30 Jul 2007v0.6.6
*) Feature: the --sysconfdir=PATH option in configure.
*) Feature: named locations.
*) Feature: the $args variable can be set with the "set" directive.
*) Feature: the $is_args variable.
*) Bugfix: fair big weight upstream balancer.
*) Bugfix: if a client has closed connection to mail proxy then nginx
might not close connection to backend.
*) Bugfix: if the same host without specified port was used as backend
for HTTP and HTTPS, then nginx used only one port - 80 or 443.
*) Bugfix: fix building on Solaris/amd64 by Sun Studio 11 and early
versions; bug appeared in 0.6.4.
Diffstat (limited to 'src/http/ngx_http_variables.c')
-rw-r--r-- | src/http/ngx_http_variables.c | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c index af54d29b0..123017d80 100644 --- a/src/http/ngx_http_variables.c +++ b/src/http/ngx_http_variables.c @@ -13,6 +13,8 @@ static ngx_int_t ngx_http_variable_request(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); +static void ngx_http_variable_request_set(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); static void ngx_http_variable_request_set_size(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); static ngx_int_t ngx_http_variable_header(ngx_http_request_t *r, @@ -39,6 +41,8 @@ static ngx_int_t ngx_http_variable_server_port(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); static ngx_int_t ngx_http_variable_scheme(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_http_variable_is_args(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); static ngx_int_t ngx_http_variable_document_root(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); static ngx_int_t ngx_http_variable_request_filename(ngx_http_request_t *r, @@ -155,9 +159,14 @@ static ngx_http_variable_t ngx_http_core_variables[] = { offsetof(ngx_http_request_t, args), NGX_HTTP_VAR_NOCACHABLE, 0 }, - { ngx_string("args"), NULL, ngx_http_variable_request, + { ngx_string("args"), + ngx_http_variable_request_set, + ngx_http_variable_request, offsetof(ngx_http_request_t, args), - NGX_HTTP_VAR_NOCACHABLE, 0 }, + NGX_HTTP_VAR_CHANGABLE|NGX_HTTP_VAR_NOCACHABLE, 0 }, + + { ngx_string("is_args"), NULL, ngx_http_variable_is_args, + 0, NGX_HTTP_VAR_NOCACHABLE, 0 }, { ngx_string("request_filename"), NULL, ngx_http_variable_request_filename, 0, @@ -501,6 +510,19 @@ ngx_http_variable_request(ngx_http_request_t *r, ngx_http_variable_value_t *v, static void +ngx_http_variable_request_set(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +{ + ngx_str_t *s; + + s = (ngx_str_t *) ((char *) r + data); + + s->len = v->len; + s->data = v->data; +} + + +static void ngx_http_variable_request_set_size(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data) { @@ -860,6 +882,27 @@ ngx_http_variable_scheme(ngx_http_request_t *r, static ngx_int_t +ngx_http_variable_is_args(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +{ + v->valid = 1; + v->no_cachable = 0; + v->not_found = 0; + + if (r->args.len == 0) { + v->len = 0; + v->data = NULL; + return NGX_OK; + } + + v->len = 1; + v->data = (u_char *) "?"; + + return NGX_OK; +} + + +static ngx_int_t ngx_http_variable_document_root(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data) { @@ -883,7 +926,9 @@ ngx_http_variable_document_root(ngx_http_request_t *r, return NGX_ERROR; } - if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, &path) == NGX_ERROR) { + if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, &path, 0) + == NGX_ERROR) + { return NGX_ERROR; } |