mirror of
https://github.com/nginx/nginx.git
synced 2025-06-12 21:52:41 +08:00
nginx-0.3.34-RELEASE import
*) Feature: the "add_header" directive supports the variables.
This commit is contained in:
parent
0443dda3d3
commit
455a7fcc1e
@ -9,6 +9,20 @@
|
|||||||
<title lang="en">nginx changelog</title>
|
<title lang="en">nginx changelog</title>
|
||||||
|
|
||||||
|
|
||||||
|
<changes ver="0.3.34" date="21.03.2006">
|
||||||
|
|
||||||
|
<change type="feature">
|
||||||
|
<para lang="ru">
|
||||||
|
ÄÉÒÅËÔÉ×Á add_header ÐÏÄÄÅÒÖÉ×ÁÅÔ ÐÅÒÅÍÅÎÎÙÅ.
|
||||||
|
</para>
|
||||||
|
<para lang="en">
|
||||||
|
the "add_header" directive supports the variables.
|
||||||
|
</para>
|
||||||
|
</change>
|
||||||
|
|
||||||
|
</changes>
|
||||||
|
|
||||||
|
|
||||||
<changes ver="0.3.33" date="15.03.2006">
|
<changes ver="0.3.33" date="15.03.2006">
|
||||||
|
|
||||||
<change type="feature">
|
<change type="feature">
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#define _NGINX_H_INCLUDED_
|
#define _NGINX_H_INCLUDED_
|
||||||
|
|
||||||
|
|
||||||
#define NGINX_VER "nginx/0.3.33"
|
#define NGINX_VER "nginx/0.3.34"
|
||||||
|
|
||||||
#define NGINX_VAR "NGINX"
|
#define NGINX_VAR "NGINX"
|
||||||
#define NGX_OLDPID_EXT ".oldbin"
|
#define NGX_OLDPID_EXT ".oldbin"
|
||||||
|
@ -10,9 +10,16 @@
|
|||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
time_t expires;
|
ngx_table_elt_t value;
|
||||||
ngx_str_t cache_control;
|
ngx_array_t *lengths;
|
||||||
ngx_array_t *headers;
|
ngx_array_t *values;
|
||||||
|
} ngx_http_header_val_t;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
time_t expires;
|
||||||
|
ngx_str_t cache_control;
|
||||||
|
ngx_array_t *headers;
|
||||||
} ngx_http_headers_conf_t;
|
} ngx_http_headers_conf_t;
|
||||||
|
|
||||||
|
|
||||||
@ -92,7 +99,8 @@ ngx_http_headers_filter(ngx_http_request_t *r)
|
|||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
ngx_uint_t i;
|
ngx_uint_t i;
|
||||||
ngx_table_elt_t *expires, *cc, **ccp, *h, *out;
|
ngx_table_elt_t *expires, *cc, **ccp, *out;
|
||||||
|
ngx_http_header_val_t *h;
|
||||||
ngx_http_headers_conf_t *conf;
|
ngx_http_headers_conf_t *conf;
|
||||||
|
|
||||||
if ((r->headers_out.status != NGX_HTTP_OK
|
if ((r->headers_out.status != NGX_HTTP_OK
|
||||||
@ -242,7 +250,20 @@ ngx_http_headers_filter(ngx_http_request_t *r)
|
|||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
*out = h[i];
|
out->hash = h[i].value.hash;
|
||||||
|
out->key = h[i].value.key;
|
||||||
|
|
||||||
|
if (h[i].lengths == NULL) {
|
||||||
|
out->value = h[i].value.value;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ngx_http_script_run(r, &out->value, h[i].lengths->elts, 0,
|
||||||
|
h[i].values->elts)
|
||||||
|
== NULL)
|
||||||
|
{
|
||||||
|
return NGX_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,8 +389,10 @@ ngx_http_headers_add(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||||||
{
|
{
|
||||||
ngx_http_headers_conf_t *hcf = conf;
|
ngx_http_headers_conf_t *hcf = conf;
|
||||||
|
|
||||||
ngx_str_t *value;
|
ngx_int_t n;
|
||||||
ngx_table_elt_t *h;
|
ngx_str_t *value;
|
||||||
|
ngx_http_header_val_t *h;
|
||||||
|
ngx_http_script_compile_t sc;
|
||||||
|
|
||||||
value = cf->args->elts;
|
value = cf->args->elts;
|
||||||
|
|
||||||
@ -379,7 +402,8 @@ ngx_http_headers_add(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hcf->headers == NULL) {
|
if (hcf->headers == NULL) {
|
||||||
hcf->headers = ngx_array_create(cf->pool, 1, sizeof(ngx_table_elt_t));
|
hcf->headers = ngx_array_create(cf->pool, 1,
|
||||||
|
sizeof(ngx_http_header_val_t));
|
||||||
if (hcf->headers == NULL) {
|
if (hcf->headers == NULL) {
|
||||||
return NGX_CONF_ERROR;
|
return NGX_CONF_ERROR;
|
||||||
}
|
}
|
||||||
@ -390,9 +414,31 @@ ngx_http_headers_add(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||||||
return NGX_CONF_ERROR;
|
return NGX_CONF_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
h->hash = 1;
|
h->value.hash = 1;
|
||||||
h->key = value[1];
|
h->value.key = value[1];
|
||||||
h->value = value[2];
|
h->value.value = value[2];
|
||||||
|
h->lengths = NULL;
|
||||||
|
h->values = NULL;
|
||||||
|
|
||||||
|
n = ngx_http_script_variables_count(&value[2]);
|
||||||
|
|
||||||
|
if (n == 0) {
|
||||||
|
return NGX_CONF_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
|
||||||
|
|
||||||
|
sc.cf = cf;
|
||||||
|
sc.source = &value[2];
|
||||||
|
sc.lengths = &h->lengths;
|
||||||
|
sc.values = &h->values;
|
||||||
|
sc.variables = n;
|
||||||
|
sc.complete_lengths = 1;
|
||||||
|
sc.complete_values = 1;
|
||||||
|
|
||||||
|
if (ngx_http_script_compile(&sc) != NGX_OK) {
|
||||||
|
return NGX_CONF_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
return NGX_CONF_OK;
|
return NGX_CONF_OK;
|
||||||
}
|
}
|
||||||
|
@ -2012,6 +2012,7 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||||||
|
|
||||||
if (conf->root.data == NULL) {
|
if (conf->root.data == NULL) {
|
||||||
|
|
||||||
|
conf->alias = prev->alias;
|
||||||
conf->root = prev->root;
|
conf->root = prev->root;
|
||||||
conf->root_lengths = prev->root_lengths;
|
conf->root_lengths = prev->root_lengths;
|
||||||
conf->root_values = prev->root_values;
|
conf->root_values = prev->root_values;
|
||||||
|
@ -689,6 +689,7 @@ ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b)
|
|||||||
default:
|
default:
|
||||||
return NGX_HTTP_PARSE_INVALID_HEADER;
|
return NGX_HTTP_PARSE_INVALID_HEADER;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
/* end of header */
|
/* end of header */
|
||||||
case sw_header_almost_done:
|
case sw_header_almost_done:
|
||||||
|
Loading…
Reference in New Issue
Block a user