comparison src/http/modules/ngx_http_ssi_filter_module.c @ 568:566e105a89f1 NGINX_0_8_36

nginx 0.8.36 *) Bugfix: the ngx_http_dav_module handled incorrectly the DELETE, COPY, and MOVE methods for symlinks. *) Bugfix: values of the $query_string, $arg_..., etc. variables cached in main request were used by the SSI module in subrequests. *) Bugfix: a variable value was repeatedly encoded after each an "echo" SSI-command output; the bug had appeared in 0.6.14. *) Bugfix: a worker process hung if a FIFO file was requested. Thanks to Vicente Aguilar and Maxim Dounin. *) Bugfix: OpenSSL-1.0.0 compatibility on 64-bit Linux. Thanks to Maxim Dounin. *) Bugfix: nginx could not be built --without-http-cache; the bug had appeared in 0.8.35.
author Igor Sysoev <http://sysoev.ru>
date Thu, 22 Apr 2010 00:00:00 +0400
parents da3c99095432
children 8246d8a2c2be
comparison
equal deleted inserted replaced
567:a49f5d0aff01 568:566e105a89f1
12 12
13 #define NGX_HTTP_SSI_DATE_LEN 2048 13 #define NGX_HTTP_SSI_DATE_LEN 2048
14 14
15 #define NGX_HTTP_SSI_ADD_PREFIX 1 15 #define NGX_HTTP_SSI_ADD_PREFIX 1
16 #define NGX_HTTP_SSI_ADD_ZERO 2 16 #define NGX_HTTP_SSI_ADD_ZERO 2
17 #define NGX_HTTP_SSI_EXPR_TEST 4
18 17
19 18
20 typedef struct { 19 typedef struct {
21 ngx_flag_t enable; 20 ngx_flag_t enable;
22 ngx_flag_t silent_errors; 21 ngx_flag_t silent_errors;
1699 key = ngx_hash_strlow(var.data, var.data, var.len); 1698 key = ngx_hash_strlow(var.data, var.data, var.len);
1700 1699
1701 val = ngx_http_ssi_get_variable(r, &var, key); 1700 val = ngx_http_ssi_get_variable(r, &var, key);
1702 1701
1703 if (val == NULL) { 1702 if (val == NULL) {
1704 vv = ngx_http_get_variable(r, &var, key, 1703 vv = ngx_http_get_variable(r, &var, key);
1705 flags & NGX_HTTP_SSI_EXPR_TEST);
1706 if (vv == NULL) { 1704 if (vv == NULL) {
1707 return NGX_ERROR; 1705 return NGX_ERROR;
1708 } 1706 }
1709 1707
1710 if (vv->not_found) { 1708 if (vv->not_found) {
2108 key = ngx_hash_strlow(var->data, var->data, var->len); 2106 key = ngx_hash_strlow(var->data, var->data, var->len);
2109 2107
2110 value = ngx_http_ssi_get_variable(r, var, key); 2108 value = ngx_http_ssi_get_variable(r, var, key);
2111 2109
2112 if (value == NULL) { 2110 if (value == NULL) {
2113 vv = ngx_http_get_variable(r, var, key, 1); 2111 vv = ngx_http_get_variable(r, var, key);
2114 2112
2115 if (vv == NULL) { 2113 if (vv == NULL) {
2116 return NGX_HTTP_SSI_ERROR; 2114 return NGX_HTTP_SSI_ERROR;
2117 } 2115 }
2118 2116
2159 "unknown encoding \"%V\" in the \"echo\" command", 2157 "unknown encoding \"%V\" in the \"echo\" command",
2160 enc); 2158 enc);
2161 } 2159 }
2162 } 2160 }
2163 2161
2162 p = value->data;
2163
2164 switch (ctx->encoding) { 2164 switch (ctx->encoding) {
2165
2166 case NGX_HTTP_SSI_NO_ENCODING:
2167 break;
2168 2165
2169 case NGX_HTTP_SSI_URL_ENCODING: 2166 case NGX_HTTP_SSI_URL_ENCODING:
2170 len = 2 * ngx_escape_uri(NULL, value->data, value->len, 2167 len = 2 * ngx_escape_uri(NULL, value->data, value->len,
2171 NGX_ESCAPE_HTML); 2168 NGX_ESCAPE_HTML);
2172 2169
2175 if (p == NULL) { 2172 if (p == NULL) {
2176 return NGX_HTTP_SSI_ERROR; 2173 return NGX_HTTP_SSI_ERROR;
2177 } 2174 }
2178 2175
2179 (void) ngx_escape_uri(p, value->data, value->len, NGX_ESCAPE_HTML); 2176 (void) ngx_escape_uri(p, value->data, value->len, NGX_ESCAPE_HTML);
2180 2177 }
2181 value->len += len; 2178
2182 value->data = p; 2179 len += value->len;
2183 }
2184
2185 break; 2180 break;
2186 2181
2187 case NGX_HTTP_SSI_ENTITY_ENCODING: 2182 case NGX_HTTP_SSI_ENTITY_ENCODING:
2188 len = ngx_escape_html(NULL, value->data, value->len); 2183 len = ngx_escape_html(NULL, value->data, value->len);
2189 2184
2192 if (p == NULL) { 2187 if (p == NULL) {
2193 return NGX_HTTP_SSI_ERROR; 2188 return NGX_HTTP_SSI_ERROR;
2194 } 2189 }
2195 2190
2196 (void) ngx_escape_html(p, value->data, value->len); 2191 (void) ngx_escape_html(p, value->data, value->len);
2197 2192 }
2198 value->len += len; 2193
2199 value->data = p; 2194 len += value->len;
2200 } 2195 break;
2201 2196
2197 default: /* NGX_HTTP_SSI_NO_ENCODING */
2198 len = value->len;
2202 break; 2199 break;
2203 } 2200 }
2204 2201
2205 b = ngx_calloc_buf(r->pool); 2202 b = ngx_calloc_buf(r->pool);
2206 if (b == NULL) { 2203 if (b == NULL) {
2211 if (cl == NULL) { 2208 if (cl == NULL) {
2212 return NGX_HTTP_SSI_ERROR; 2209 return NGX_HTTP_SSI_ERROR;
2213 } 2210 }
2214 2211
2215 b->memory = 1; 2212 b->memory = 1;
2216 b->pos = value->data; 2213 b->pos = p;
2217 b->last = value->data + value->len; 2214 b->last = p + len;
2218 2215
2219 cl->buf = b; 2216 cl->buf = b;
2220 cl->next = NULL; 2217 cl->next = NULL;
2221 *ctx->last_out = cl; 2218 *ctx->last_out = cl;
2222 ctx->last_out = &cl->next; 2219 ctx->last_out = &cl->next;
2360 2357
2361 while (p < last && *p == ' ') { 2358 while (p < last && *p == ' ') {
2362 p++; 2359 p++;
2363 } 2360 }
2364 2361
2365 flags = (p == last) ? NGX_HTTP_SSI_EXPR_TEST : 0; 2362 flags = 0;
2366 2363
2367 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 2364 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
2368 "left: \"%V\"", &left); 2365 "left: \"%V\"", &left);
2369 2366
2370 rc = ngx_http_ssi_evaluate_string(r, ctx, &left, flags); 2367 rc = ngx_http_ssi_evaluate_string(r, ctx, &left, flags);