# HG changeset patch # User Igor Sysoev # Date 1122235200 -14400 # Node ID 2aa14f638cf0263dedd4c517eebbfc99702c586a # Parent 4e854e6d19863dee6b9cbcee993a1be3babdd9f3 nginx 0.1.41 *) Bugfix: if the variable was used in the configuration file, then it can not be used in SSI. diff --git a/CHANGES b/CHANGES --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ + +Changes with nginx 0.1.41 25 Jul 2005 + + *) Bugfix: if the variable was used in the configuration file, then it + can not be used in SSI. + Changes with nginx 0.1.40 22 Jul 2005 diff --git a/CHANGES.ru b/CHANGES.ru --- a/CHANGES.ru +++ b/CHANGES.ru @@ -1,3 +1,9 @@ + +Изменения в nginx 0.1.41 25.07.2005 + + *) Исправление: если переменная использовалась в файле конфигурации, то + она не могла использоваться в SSI. + Изменения в nginx 0.1.40 22.07.2005 diff --git a/src/core/nginx.h b/src/core/nginx.h --- a/src/core/nginx.h +++ b/src/core/nginx.h @@ -8,7 +8,7 @@ #define _NGINX_H_INCLUDED_ -#define NGINX_VER "nginx/0.1.40" +#define NGINX_VER "nginx/0.1.41" #define NGINX_VAR "NGINX" #define NGX_NEWPID_EXT ".newbin" diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c --- a/src/http/modules/ngx_http_proxy_module.c +++ b/src/http/modules/ngx_http_proxy_module.c @@ -320,19 +320,19 @@ static ngx_table_elt_t ngx_http_proxy_h static ngx_http_variable_t ngx_http_proxy_vars[] = { { ngx_string("proxy_host"), ngx_http_proxy_host_variable, 0, - NGX_HTTP_VAR_CHANGABLE }, + NGX_HTTP_VAR_CHANGABLE, 0 }, { ngx_string("proxy_port"), ngx_http_proxy_port_variable, 0, - NGX_HTTP_VAR_CHANGABLE }, + NGX_HTTP_VAR_CHANGABLE, 0 }, { ngx_string("proxy_add_x_forwarded_for"), - ngx_http_proxy_add_x_forwarded_for_variable, 0, 0 }, + ngx_http_proxy_add_x_forwarded_for_variable, 0, 0, 0 }, #if 0 - { ngx_string("proxy_add_via"), NULL, 0, 0 }, + { ngx_string("proxy_add_via"), NULL, 0, 0, 0 }, #endif - { ngx_null_string, NULL, 0, 0 } + { ngx_null_string, NULL, 0, 0, 0 } }; diff --git a/src/http/modules/ngx_http_ssi_filter_module.c b/src/http/modules/ngx_http_ssi_filter_module.c --- a/src/http/modules/ngx_http_ssi_filter_module.c +++ b/src/http/modules/ngx_http_ssi_filter_module.c @@ -278,12 +278,12 @@ static ngx_http_ssi_command_t ngx_http_ static ngx_http_variable_t ngx_http_ssi_vars[] = { { ngx_string("date_local"), ngx_http_ssi_date_gmt_local_variable, 0, - NGX_HTTP_VAR_NOCACHABLE }, + NGX_HTTP_VAR_NOCACHABLE, 0 }, { ngx_string("date_gmt"), ngx_http_ssi_date_gmt_local_variable, 1, - NGX_HTTP_VAR_NOCACHABLE }, + NGX_HTTP_VAR_NOCACHABLE, 0 }, - { ngx_null_string, NULL, 0, 0 } + { ngx_null_string, NULL, 0, 0, 0 } }; diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c --- a/src/http/ngx_http_variables.c +++ b/src/http/ngx_http_variables.c @@ -47,71 +47,71 @@ static ngx_http_variable_value_t * static ngx_http_variable_t ngx_http_core_variables[] = { { ngx_string("http_host"), ngx_http_variable_header, - offsetof(ngx_http_request_t, headers_in.host), 0 }, + offsetof(ngx_http_request_t, headers_in.host), 0, 0 }, { ngx_string("http_user_agent"), ngx_http_variable_header, - offsetof(ngx_http_request_t, headers_in.user_agent), 0 }, + offsetof(ngx_http_request_t, headers_in.user_agent), 0, 0 }, { ngx_string("http_referer"), ngx_http_variable_header, - offsetof(ngx_http_request_t, headers_in.referer), 0 }, + offsetof(ngx_http_request_t, headers_in.referer), 0, 0 }, #if (NGX_HTTP_GZIP) { ngx_string("http_via"), ngx_http_variable_header, - offsetof(ngx_http_request_t, headers_in.via), 0 }, + offsetof(ngx_http_request_t, headers_in.via), 0, 0 }, #endif #if (NGX_HTTP_PROXY) { ngx_string("http_x_forwarded_for"), ngx_http_variable_header, - offsetof(ngx_http_request_t, headers_in.x_forwarded_for), 0 }, + offsetof(ngx_http_request_t, headers_in.x_forwarded_for), 0, 0 }, #endif { ngx_string("http_cookie"), ngx_http_variable_headers, - offsetof(ngx_http_request_t, headers_in.cookies), 0 }, + offsetof(ngx_http_request_t, headers_in.cookies), 0, 0 }, { ngx_string("content_length"), ngx_http_variable_header, - offsetof(ngx_http_request_t, headers_in.content_length), 0 }, + offsetof(ngx_http_request_t, headers_in.content_length), 0, 0 }, { ngx_string("content_type"), ngx_http_variable_header, - offsetof(ngx_http_request_t, headers_in.content_type), 0 }, + offsetof(ngx_http_request_t, headers_in.content_type), 0, 0 }, - { ngx_string("host"), ngx_http_variable_host, 0, 0 }, + { ngx_string("host"), ngx_http_variable_host, 0, 0, 0 }, - { ngx_string("remote_addr"), ngx_http_variable_remote_addr, 0, 0 }, + { ngx_string("remote_addr"), ngx_http_variable_remote_addr, 0, 0, 0 }, - { ngx_string("remote_port"), ngx_http_variable_remote_port, 0, 0 }, + { ngx_string("remote_port"), ngx_http_variable_remote_port, 0, 0, 0 }, - { ngx_string("server_addr"), ngx_http_variable_server_addr, 0, 0 }, + { ngx_string("server_addr"), ngx_http_variable_server_addr, 0, 0, 0 }, - { ngx_string("server_port"), ngx_http_variable_server_port, 0, 0 }, + { ngx_string("server_port"), ngx_http_variable_server_port, 0, 0, 0 }, { ngx_string("server_protocol"), ngx_http_variable_request, - offsetof(ngx_http_request_t, http_protocol), 0 }, + offsetof(ngx_http_request_t, http_protocol), 0, 0 }, { ngx_string("request_uri"), ngx_http_variable_request, - offsetof(ngx_http_request_t, unparsed_uri), 0 }, + offsetof(ngx_http_request_t, unparsed_uri), 0, 0 }, { ngx_string("document_uri"), ngx_http_variable_request, - offsetof(ngx_http_request_t, uri), 0 }, + offsetof(ngx_http_request_t, uri), 0, 0 }, - { ngx_string("document_root"), ngx_http_variable_document_root, 0, 0 }, + { ngx_string("document_root"), ngx_http_variable_document_root, 0, 0, 0 }, { ngx_string("query_string"), ngx_http_variable_request, offsetof(ngx_http_request_t, args), - NGX_HTTP_VAR_NOCACHABLE }, + NGX_HTTP_VAR_NOCACHABLE, 0 }, { ngx_string("request_filename"), ngx_http_variable_request_filename, 0, - NGX_HTTP_VAR_NOCACHABLE }, + NGX_HTTP_VAR_NOCACHABLE, 0 }, { ngx_string("server_name"), ngx_http_variable_request, - offsetof(ngx_http_request_t, server_name), 0 }, + offsetof(ngx_http_request_t, server_name), 0, 0 }, { ngx_string("request_method"), ngx_http_variable_request, - offsetof(ngx_http_request_t, method_name), 0 }, + offsetof(ngx_http_request_t, method_name), 0, 0 }, { ngx_string("remote_user"), ngx_http_variable_request, - offsetof(ngx_http_request_t, headers_in.user), 0 }, + offsetof(ngx_http_request_t, headers_in.user), 0, 0 }, - { ngx_null_string, NULL, 0, 0 } + { ngx_null_string, NULL, 0, 0, 0 } }; @@ -159,6 +159,7 @@ ngx_http_add_variable(ngx_conf_t *cf, ng v->handler = NULL; v->data = 0; v->flags = flags; + v->index = 0; return v; } @@ -212,6 +213,7 @@ ngx_http_get_variable_index(ngx_conf_t * v->handler = NULL; v->data = 0; v->flags = 0; + v->index = cmcf->variables.nelts - 1; return cmcf->variables.nelts - 1; } @@ -277,7 +279,7 @@ ngx_http_get_variable(ngx_http_request_t && ngx_strncmp(v[key].name.data, name->data, name->len) == 0) { if (v[key].flags & NGX_HTTP_VAR_INDEXED) { - return ngx_http_get_indexed_variable(r, v[key].data); + return ngx_http_get_indexed_variable(r, v[key].index); } else { return v[key].handler(r, v[key].data); @@ -710,6 +712,8 @@ ngx_http_variables_init_vars(ngx_conf_t av[n].flags |= NGX_HTTP_VAR_INDEXED; v[i].flags = av[n].flags; + av[n].index = i; + goto next; } } diff --git a/src/http/ngx_http_variables.h b/src/http/ngx_http_variables.h --- a/src/http/ngx_http_variables.h +++ b/src/http/ngx_http_variables.h @@ -38,6 +38,7 @@ struct ngx_http_variable_s { ngx_http_get_variable_pt handler; uintptr_t data; ngx_uint_t flags; + ngx_uint_t index; };