summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2005-08-19 08:54:17 +0000
committerIgor Sysoev <igor@sysoev.ru>2005-08-19 08:54:17 +0000
commit559814049f137c819308937d543a33432e0e2280 (patch)
treeb6169bb826ea100e22152dca9b85567839666037
parentf6c7d898a8115a411391a371ef8d70ff528fbdcc (diff)
downloadnginx-release-0.1.41.tar.gz
nginx-0.1.41-RELEASE importrelease-0.1.41
*) Bugfix: if the variable was used in the configuration file, then it can not be used in SSI.
-rw-r--r--docs/xml/nginx/changes.xml16
-rw-r--r--src/core/nginx.h2
-rw-r--r--src/http/modules/ngx_http_proxy_module.c10
-rw-r--r--src/http/modules/ngx_http_ssi_filter_module.c6
-rw-r--r--src/http/ngx_http_variables.c52
-rw-r--r--src/http/ngx_http_variables.h1
6 files changed, 54 insertions, 33 deletions
diff --git a/docs/xml/nginx/changes.xml b/docs/xml/nginx/changes.xml
index 661d9e091..0dbd65260 100644
--- 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">
diff --git a/src/core/nginx.h b/src/core/nginx.h
index 6f14bdf53..281036f33 100644
--- 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
index 92605e060..8288df1c4 100644
--- 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_headers[] = {
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
index bf9c12411..6507105e3 100644
--- 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_ssi_commands[] = {
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
index 2a5cf7dcd..3e3f9f7bf 100644
--- 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, ngx_str_t *name, ngx_uint_t flags)
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 *cf, ngx_str_t *name)
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 *r, ngx_str_t *name)
&& 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 *cf)
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
index d986c7d21..df0fc9efa 100644
--- 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;
};