Mercurial > hg > nginx-ranges
diff src/http/modules/ngx_http_ssi_filter_module.c @ 206:3866d57d9cfd NGINX_0_3_50
nginx 0.3.50
*) Change: the "proxy_redirect_errors" and "fastcgi_redirect_errors"
directives was renamed to the "proxy_intercept_errors" and
"fastcgi_intercept_errors" directives.
*) Feature: the ngx_http_charset_module supports the recoding from the
single byte encodings to the UTF-8 encoding and back.
*) Feature: the "X-Accel-Charset" response header line is supported in
proxy and FastCGI mode.
*) Bugfix: the "\" escape symbol in the "\"" and "\'" pairs in the SSI
command was removed only if the command also has the "$" symbol.
*) Bugfix: the "<!--" string might be added on some conditions in the
SSI after inclusion.
*) Bugfix: if the "Content-Length: 0" header line was in response, then
in nonbuffered proxying mode the client connection was not closed.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 28 Jun 2006 00:00:00 +0400 |
parents | d2ae1c9f1fd3 |
children | b12b3b1a9426 |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_ssi_filter_module.c +++ b/src/http/modules/ngx_http_ssi_filter_module.c @@ -788,7 +788,8 @@ ngx_http_ssi_output(ngx_http_request_t * while (ctx->busy) { - b = ctx->busy->buf; + cl = ctx->busy; + b = cl->buf; if (ngx_buf_size(b) != 0) { break; @@ -804,7 +805,6 @@ ngx_http_ssi_output(ngx_http_request_t * b->shadow->pos = b->shadow->last; } - cl = ctx->busy; ctx->busy = cl->next; if (ngx_buf_in_memory(b) || b->in_file) { @@ -942,9 +942,7 @@ ngx_http_ssi_parse(ngx_http_request_t *r case ssi_sharp_state: switch (ch) { case '#': - if (ctx->copy_start) { - ctx->saved = 0; - } + ctx->saved = 0; looked = 0; state = ssi_precommand_state; break; @@ -1417,11 +1415,11 @@ ngx_http_ssi_evaluate_string(ngx_http_re if (n == 0) { - if (!(flags & NGX_HTTP_SSI_ADD_PREFIX)) { - return NGX_OK; - } - - if (text->data[0] != '/') { + data = text->data; + p = data; + + if ((flags & NGX_HTTP_SSI_ADD_PREFIX) && text->data[0] != '/') { + for (prefix = r->uri.len; prefix; prefix--) { if (r->uri.data[prefix - 1] == '/') { break; @@ -1437,13 +1435,35 @@ ngx_http_ssi_evaluate_string(ngx_http_re } p = ngx_copy(data, r->uri.data, prefix); - ngx_memcpy(p, text->data, text->len); - - text->len = len; - text->data = data; } } + quoted = 0; + + for (i = 0 ; i < text->len; i++) { + ch = text->data[i]; + + if (!quoted) { + + if (ch == '\\') { + quoted = 1; + continue; + } + + } else { + quoted = 0; + + if (ch != '\\' && ch != '\'' && ch != '"' && ch != '$') { + *p++ = '\\'; + } + } + + *p++ = ch; + } + + text->len = p - data; + text->data = data; + return NGX_OK; } @@ -2140,6 +2160,7 @@ ngx_http_ssi_date_gmt_local_variable(ngx v->len = ngx_sprintf(v->data, "%T", tp->sec + (gmt ? 0 : tp->gmtoff)) - v->data; + return NGX_OK; }