From c9115e73d5663dcaf9f8c4302c14a2dea51cd667 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Wed, 12 Dec 2007 20:56:13 +0000 Subject: r1594 merge: unescape SSI include --- src/http/modules/ngx_http_ssi_filter_module.c | 20 +++++++++++++++++--- src/http/ngx_http_script.c | 3 ++- 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'src/http') diff --git a/src/http/modules/ngx_http_ssi_filter_module.c b/src/http/modules/ngx_http_ssi_filter_module.c index 60aed18f8..ae72ee379 100644 --- a/src/http/modules/ngx_http_ssi_filter_module.c +++ b/src/http/modules/ngx_http_ssi_filter_module.c @@ -1858,6 +1858,8 @@ static ngx_int_t ngx_http_ssi_include(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, ngx_str_t **params) { + u_char *dst, *src; + size_t len; ngx_int_t rc, key; ngx_str_t *uri, *file, *wait, *set, *stub, args; ngx_buf_t *b; @@ -1927,13 +1929,25 @@ ngx_http_ssi_include(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, return rc; } - args.len = 0; - args.data = NULL; - flags = 0; + dst = uri->data; + src = uri->data; + + ngx_unescape_uri(&dst, &src, uri->len, NGX_UNESCAPE_URI); + + len = (uri->data + uri->len) - src; + if (len) { + dst = ngx_copy(dst, src, len); + } + + uri->len = dst - uri->data; ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ssi include: \"%V\"", uri); + args.len = 0; + args.data = NULL; + flags = 0; + if (ngx_http_parse_unsafe_uri(r, uri, &args, &flags) != NGX_OK) { return NGX_HTTP_SSI_ERROR; } diff --git a/src/http/ngx_http_script.c b/src/http/ngx_http_script.c index 235a5b514..a2994378a 100644 --- a/src/http/ngx_http_script.c +++ b/src/http/ngx_http_script.c @@ -750,7 +750,8 @@ ngx_http_script_regex_end_code(ngx_http_script_engine_t *e) dst = e->buf.data; src = e->buf.data; - ngx_unescape_uri(&dst, &src, e->pos - e->buf.data, NGX_UNESCAPE_URI); + ngx_unescape_uri(&dst, &src, e->pos - e->buf.data, + NGX_UNESCAPE_REDIRECT); if (src < e->pos) { dst = ngx_copy(dst, src, e->pos - src); -- cgit v1.2.3