Mercurial > hg > nginx
comparison src/http/modules/ngx_http_ssi_filter_module.c @ 3495:6a5dc3803825
do not store an encoded variable value as a new cached variable value
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 21 Apr 2010 14:58:21 +0000 |
parents | 04966b3122ab |
children | 0eb46e3c5c02 |
comparison
equal
deleted
inserted
replaced
3494:67b8a4e0d7e1 | 3495:6a5dc3803825 |
---|---|
2159 "unknown encoding \"%V\" in the \"echo\" command", | 2159 "unknown encoding \"%V\" in the \"echo\" command", |
2160 enc); | 2160 enc); |
2161 } | 2161 } |
2162 } | 2162 } |
2163 | 2163 |
2164 p = value->data; | |
2165 | |
2164 switch (ctx->encoding) { | 2166 switch (ctx->encoding) { |
2165 | |
2166 case NGX_HTTP_SSI_NO_ENCODING: | |
2167 break; | |
2168 | 2167 |
2169 case NGX_HTTP_SSI_URL_ENCODING: | 2168 case NGX_HTTP_SSI_URL_ENCODING: |
2170 len = 2 * ngx_escape_uri(NULL, value->data, value->len, | 2169 len = 2 * ngx_escape_uri(NULL, value->data, value->len, |
2171 NGX_ESCAPE_HTML); | 2170 NGX_ESCAPE_HTML); |
2172 | 2171 |
2175 if (p == NULL) { | 2174 if (p == NULL) { |
2176 return NGX_HTTP_SSI_ERROR; | 2175 return NGX_HTTP_SSI_ERROR; |
2177 } | 2176 } |
2178 | 2177 |
2179 (void) ngx_escape_uri(p, value->data, value->len, NGX_ESCAPE_HTML); | 2178 (void) ngx_escape_uri(p, value->data, value->len, NGX_ESCAPE_HTML); |
2180 | 2179 } |
2181 value->len += len; | 2180 |
2182 value->data = p; | 2181 len += value->len; |
2183 } | |
2184 | |
2185 break; | 2182 break; |
2186 | 2183 |
2187 case NGX_HTTP_SSI_ENTITY_ENCODING: | 2184 case NGX_HTTP_SSI_ENTITY_ENCODING: |
2188 len = ngx_escape_html(NULL, value->data, value->len); | 2185 len = ngx_escape_html(NULL, value->data, value->len); |
2189 | 2186 |
2192 if (p == NULL) { | 2189 if (p == NULL) { |
2193 return NGX_HTTP_SSI_ERROR; | 2190 return NGX_HTTP_SSI_ERROR; |
2194 } | 2191 } |
2195 | 2192 |
2196 (void) ngx_escape_html(p, value->data, value->len); | 2193 (void) ngx_escape_html(p, value->data, value->len); |
2197 | 2194 } |
2198 value->len += len; | 2195 |
2199 value->data = p; | 2196 len += value->len; |
2200 } | 2197 break; |
2201 | 2198 |
2199 default: /* NGX_HTTP_SSI_NO_ENCODING */ | |
2200 len = value->len; | |
2202 break; | 2201 break; |
2203 } | 2202 } |
2204 | 2203 |
2205 b = ngx_calloc_buf(r->pool); | 2204 b = ngx_calloc_buf(r->pool); |
2206 if (b == NULL) { | 2205 if (b == NULL) { |
2211 if (cl == NULL) { | 2210 if (cl == NULL) { |
2212 return NGX_HTTP_SSI_ERROR; | 2211 return NGX_HTTP_SSI_ERROR; |
2213 } | 2212 } |
2214 | 2213 |
2215 b->memory = 1; | 2214 b->memory = 1; |
2216 b->pos = value->data; | 2215 b->pos = p; |
2217 b->last = value->data + value->len; | 2216 b->last = p + len; |
2218 | 2217 |
2219 cl->buf = b; | 2218 cl->buf = b; |
2220 cl->next = NULL; | 2219 cl->next = NULL; |
2221 *ctx->last_out = cl; | 2220 *ctx->last_out = cl; |
2222 ctx->last_out = &cl->next; | 2221 ctx->last_out = &cl->next; |