diff --git a/docs/xml/nginx/changes.xml b/docs/xml/nginx/changes.xml index b6c9d3e86..f631b20ec 100644 --- a/docs/xml/nginx/changes.xml +++ b/docs/xml/nginx/changes.xml @@ -9,6 +9,51 @@ nginx changelog + + + + +дублирующее значение переменной модуля ngx_http_geo_module теперь +выдаёт предупреждение и изменяёт старое значение. + + +the duplicate value of the ngx_http_geo_module variable now causes +the warning and changes old value. + + + + + +модуль ngx_http_ssi_module поддерживает команду set. + + +the ngx_http_ssi_module supports the "set" command. + + + + + +модуль ngx_http_ssi_module поддерживает параметр file в команде include. + + +the ngx_http_ssi_module supports the "file" parameter in the "include" command. + + + + + +модуль ngx_http_ssi_module поддерживает подстановку значений переменных +в выражениях команды if. + + +the ngx_http_ssi_module supports the variable value substitutions in +epxiressions of the "if" command. + + + + + + diff --git a/src/core/nginx.h b/src/core/nginx.h index 567a18802..b36e94417 100644 --- a/src/core/nginx.h +++ b/src/core/nginx.h @@ -8,7 +8,7 @@ #define _NGINX_H_INCLUDED_ -#define NGINX_VER "nginx/0.2.4" +#define NGINX_VER "nginx/0.2.5" #define NGINX_VAR "NGINX" #define NGX_OLDPID_EXT ".oldbin" diff --git a/src/http/modules/ngx_http_autoindex_module.c b/src/http/modules/ngx_http_autoindex_module.c index d5a6b69ba..f56896489 100644 --- a/src/http/modules/ngx_http_autoindex_module.c +++ b/src/http/modules/ngx_http_autoindex_module.c @@ -514,7 +514,7 @@ ngx_http_autoindex_handler(ngx_http_request_t *r) b->last = ngx_cpymem(b->last, tail, sizeof(tail) - 1); - if (r->main == NULL) { + if (r->main == r) { b->last_buf = 1; } diff --git a/src/http/modules/ngx_http_chunked_filter_module.c b/src/http/modules/ngx_http_chunked_filter_module.c index bfa362408..85ca93486 100644 --- a/src/http/modules/ngx_http_chunked_filter_module.c +++ b/src/http/modules/ngx_http_chunked_filter_module.c @@ -50,7 +50,7 @@ static ngx_http_output_body_filter_pt ngx_http_next_body_filter; static ngx_int_t ngx_http_chunked_header_filter(ngx_http_request_t *r) { - if (r->headers_out.status == NGX_HTTP_NOT_MODIFIED || r->main) { + if (r->headers_out.status == NGX_HTTP_NOT_MODIFIED || r->main != r) { return ngx_http_next_header_filter(r); } diff --git a/src/http/modules/ngx_http_geo_module.c b/src/http/modules/ngx_http_geo_module.c index 2031a4c0b..eedc1f7b2 100644 --- a/src/http/modules/ngx_http_geo_module.c +++ b/src/http/modules/ngx_http_geo_module.c @@ -182,11 +182,11 @@ static char * ngx_http_geo(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) { ngx_int_t rc, n; - ngx_uint_t i; ngx_str_t *value, file; + ngx_uint_t i; ngx_inet_cidr_t cidrin; ngx_http_geo_conf_t *geo; - ngx_http_variable_value_t *var, **v; + ngx_http_variable_value_t *var, *old, **v; geo = cf->ctx; @@ -274,17 +274,33 @@ ngx_http_geo(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) *v = var; } - rc = ngx_radix32tree_insert(geo->tree, cidrin.addr, cidrin.mask, - (uintptr_t) var); - if (rc == NGX_ERROR) { - return NGX_CONF_ERROR; + for (i = 2; i; i--) { + rc = ngx_radix32tree_insert(geo->tree, cidrin.addr, cidrin.mask, + (uintptr_t) var); + if (rc == NGX_OK) { + return NGX_CONF_OK; + } + + if (rc == NGX_ERROR) { + return NGX_CONF_ERROR; + } + + /* rc == NGX_BUSY */ + + old = (ngx_http_variable_value_t *) + ngx_radix32tree_find(geo->tree, cidrin.addr & cidrin.mask); + + ngx_conf_log_error(NGX_LOG_WARN, cf, 0, + "duplicate parameter \"%V\", value: \"%V\", " + "old value: \"%V\"", + &value[0], &var->text, &old->text); + + rc = ngx_radix32tree_delete(geo->tree, cidrin.addr, cidrin.mask); + + if (rc == NGX_ERROR) { + return NGX_CONF_ERROR; + } } - if (rc == NGX_BUSY) { - ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "duplicate parameter \"%V\"", - &value[0]); - return NGX_CONF_ERROR; - } - - return NGX_CONF_OK; + return NGX_CONF_ERROR; } diff --git a/src/http/modules/ngx_http_gzip_filter_module.c b/src/http/modules/ngx_http_gzip_filter_module.c index 012ea4581..923dd1724 100644 --- a/src/http/modules/ngx_http_gzip_filter_module.c +++ b/src/http/modules/ngx_http_gzip_filter_module.c @@ -280,7 +280,7 @@ ngx_http_gzip_header_filter(ngx_http_request_t *r) && r->headers_out.status != NGX_HTTP_FORBIDDEN && r->headers_out.status != NGX_HTTP_NOT_FOUND) || r->header_only - || r->main + || r->main != r || r->http_version < conf->http_version || r->headers_out.content_type.len == 0 || (r->headers_out.content_encoding diff --git a/src/http/modules/ngx_http_headers_filter_module.c b/src/http/modules/ngx_http_headers_filter_module.c index 43cb5c8cd..0855990a5 100644 --- a/src/http/modules/ngx_http_headers_filter_module.c +++ b/src/http/modules/ngx_http_headers_filter_module.c @@ -84,7 +84,7 @@ ngx_http_headers_filter(ngx_http_request_t *r) if ((r->headers_out.status != NGX_HTTP_OK && r->headers_out.status != NGX_HTTP_NOT_MODIFIED) - || r->main) + || r->main != r) { return ngx_http_next_header_filter(r); } diff --git a/src/http/modules/ngx_http_not_modified_filter_module.c b/src/http/modules/ngx_http_not_modified_filter_module.c index 6712a917d..1e2db62cd 100644 --- a/src/http/modules/ngx_http_not_modified_filter_module.c +++ b/src/http/modules/ngx_http_not_modified_filter_module.c @@ -52,7 +52,7 @@ static ngx_int_t ngx_http_not_modified_header_filter(ngx_http_request_t *r) time_t ims; if (r->headers_out.status != NGX_HTTP_OK - || r->main + || r->main != r || r->headers_in.if_modified_since == NULL || r->headers_out.last_modified_time == -1) { diff --git a/src/http/modules/ngx_http_range_filter_module.c b/src/http/modules/ngx_http_range_filter_module.c index c62649595..c8b30b850 100644 --- a/src/http/modules/ngx_http_range_filter_module.c +++ b/src/http/modules/ngx_http_range_filter_module.c @@ -134,7 +134,7 @@ ngx_http_range_header_filter(ngx_http_request_t *r) if (r->http_version < NGX_HTTP_VERSION_10 || r->headers_out.status != NGX_HTTP_OK - || r->main + || r->main != r || r->headers_out.content_length_n == -1 || !r->filter_allow_ranges) { diff --git a/src/http/modules/ngx_http_ssi_filter_module.c b/src/http/modules/ngx_http_ssi_filter_module.c index 885d29817..acbae29eb 100644 --- a/src/http/modules/ngx_http_ssi_filter_module.c +++ b/src/http/modules/ngx_http_ssi_filter_module.c @@ -8,15 +8,18 @@ #include #include -#define NGX_HTTP_SSI_MAX_PARAMS 16 +#define NGX_HTTP_SSI_MAX_PARAMS 16 -#define NGX_HTTP_SSI_COMMAND_LEN 31 -#define NGX_HTTP_SSI_PARAM_LEN 31 -#define NGX_HTTP_SSI_PARAMS_N 4 +#define NGX_HTTP_SSI_COMMAND_LEN 31 +#define NGX_HTTP_SSI_PARAM_LEN 31 +#define NGX_HTTP_SSI_PARAMS_N 4 -#define NGX_HTTP_SSI_ERROR 1 +#define NGX_HTTP_SSI_ERROR 1 -#define NGX_HTTP_SSI_DATE_LEN 2048 +#define NGX_HTTP_SSI_DATE_LEN 2048 + + +#define NGX_HTTP_SSI_ADD_PREFIX 1 typedef struct { @@ -31,6 +34,12 @@ typedef struct { } ngx_http_ssi_conf_t; +typedef struct { + ngx_str_t name; + ngx_str_t value; +} ngx_http_ssi_var_t; + + typedef struct { ngx_buf_t *buf; @@ -56,6 +65,8 @@ typedef struct { size_t value_len; + ngx_array_t variables; + ngx_uint_t output; /* unsigned output:1; */ ngx_str_t timefmt; @@ -113,12 +124,18 @@ static ngx_int_t ngx_http_ssi_output(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx); static ngx_int_t ngx_http_ssi_parse(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx); +static ngx_str_t *ngx_http_ssi_get_variable(ngx_http_request_t *r, + ngx_str_t *name); +static ngx_int_t ngx_http_ssi_evaluate_string(ngx_http_request_t *r, + ngx_http_ssi_ctx_t *ctx, ngx_str_t *text, ngx_uint_t flags); +static ngx_int_t ngx_http_ssi_include(ngx_http_request_t *r, + ngx_http_ssi_ctx_t *ctx, ngx_str_t **params); static ngx_int_t ngx_http_ssi_echo(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, ngx_str_t **params); static ngx_int_t ngx_http_ssi_config(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, ngx_str_t **params); -static ngx_int_t ngx_http_ssi_include(ngx_http_request_t *r, +static ngx_int_t ngx_http_ssi_set(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, ngx_str_t **params); static ngx_int_t ngx_http_ssi_if(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, ngx_str_t **params); @@ -221,6 +238,8 @@ static u_char ngx_http_ssi_string[] = "