Mercurial > hg > nginx
changeset 533:d6e48c08d718 release-0.1.41
nginx-0.1.41-RELEASE import
*) Bugfix: if the variable was used in the configuration file, then it
can not be used in SSI.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 19 Aug 2005 08:54:17 +0000 |
parents | 6fadb47f2d26 |
children | 68651071a155 |
files | docs/xml/nginx/changes.xml src/core/nginx.h src/http/modules/ngx_http_proxy_module.c src/http/modules/ngx_http_ssi_filter_module.c src/http/ngx_http_variables.c src/http/ngx_http_variables.h |
diffstat | 6 files changed, 54 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/docs/xml/nginx/changes.xml +++ b/docs/xml/nginx/changes.xml @@ -9,6 +9,22 @@ <title lang="en">nginx changelog</title> +<changes ver="0.1.41" date="25.07.2005"> + +<change type="bugfix"> +<para lang="ru"> +если переменная использовалась в файле конфигурации, +то она не могла использоваться в SSI. +</para> +<para lang="en"> +if the variable was used in the configuration file, +then it can not be used in SSI. +</para> +</change> + +</changes> + + <changes ver="0.1.40" date="22.07.2005"> <change type="bugfix">
--- 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"
--- 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 } };
--- 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 } };
--- 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; } }