diff options
author | Igor Sysoev <igor@sysoev.ru> | 2007-12-12 23:56:13 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2007-12-12 23:56:13 +0300 |
commit | c9115e73d5663dcaf9f8c4302c14a2dea51cd667 (patch) | |
tree | 2fed39d46b25cf49c218bf029360b0c62ef9ca6f /src/http | |
parent | d66b7a8a1ae71d0c4e2d767f4d06f05890169b56 (diff) |
r1594 merge:
unescape SSI include
Diffstat (limited to 'src/http')
-rw-r--r-- | src/http/modules/ngx_http_ssi_filter_module.c | 20 | ||||
-rw-r--r-- | src/http/ngx_http_script.c | 3 |
2 files changed, 19 insertions, 4 deletions
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); |