nginx-0.1.41-RELEASE import

*) Bugfix: if the variable was used in the configuration file, then it
       can not be used in SSI.
This commit is contained in:
Igor Sysoev 2005-08-19 08:54:17 +00:00
parent f6c7d898a8
commit 559814049f
6 changed files with 54 additions and 33 deletions

View File

@ -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">

View File

@ -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"

View File

@ -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 }
};

View File

@ -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 }
};

View File

@ -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;
}
}

View File

@ -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;
};