Mercurial > hg > nginx
comparison src/http/modules/ngx_http_ssi_filter_module.c @ 5491:74bfa803a5aa
Teach ngx_http_parse_unsafe_uri() how to unescape URIs.
This fixes handling of escaped URIs in X-Accel-Redirect (ticket #316),
SSI (ticket #240), and DAV.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Mon, 23 Dec 2013 18:12:00 +0400 |
parents | cbd4bbe976d4 |
children | 3a8e19528b30 |
comparison
equal
deleted
inserted
replaced
5490:b141a7627ac6 | 5491:74bfa803a5aa |
---|---|
1980 | 1980 |
1981 static ngx_int_t | 1981 static ngx_int_t |
1982 ngx_http_ssi_include(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, | 1982 ngx_http_ssi_include(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, |
1983 ngx_str_t **params) | 1983 ngx_str_t **params) |
1984 { | 1984 { |
1985 u_char *dst, *src; | |
1986 size_t len; | |
1987 ngx_int_t rc, key; | 1985 ngx_int_t rc, key; |
1988 ngx_str_t *uri, *file, *wait, *set, *stub, args; | 1986 ngx_str_t *uri, *file, *wait, *set, *stub, args; |
1989 ngx_buf_t *b; | 1987 ngx_buf_t *b; |
1990 ngx_uint_t flags, i; | 1988 ngx_uint_t flags, i; |
1991 ngx_chain_t *cl, *tl, **ll, *out; | 1989 ngx_chain_t *cl, *tl, **ll, *out; |
2051 rc = ngx_http_ssi_evaluate_string(r, ctx, uri, NGX_HTTP_SSI_ADD_PREFIX); | 2049 rc = ngx_http_ssi_evaluate_string(r, ctx, uri, NGX_HTTP_SSI_ADD_PREFIX); |
2052 | 2050 |
2053 if (rc != NGX_OK) { | 2051 if (rc != NGX_OK) { |
2054 return rc; | 2052 return rc; |
2055 } | 2053 } |
2056 | |
2057 dst = uri->data; | |
2058 src = uri->data; | |
2059 | |
2060 ngx_unescape_uri(&dst, &src, uri->len, NGX_UNESCAPE_URI); | |
2061 | |
2062 len = (uri->data + uri->len) - src; | |
2063 if (len) { | |
2064 dst = ngx_movemem(dst, src, len); | |
2065 } | |
2066 | |
2067 uri->len = dst - uri->data; | |
2068 | 2054 |
2069 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 2055 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2070 "ssi include: \"%V\"", uri); | 2056 "ssi include: \"%V\"", uri); |
2071 | 2057 |
2072 ngx_str_null(&args); | 2058 ngx_str_null(&args); |