diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2007-12-12 20:56:13 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2007-12-12 20:56:13 +0000 |
| commit | c9115e73d5663dcaf9f8c4302c14a2dea51cd667 (patch) | |
| tree | 2fed39d46b25cf49c218bf029360b0c62ef9ca6f /src/core | |
| parent | d66b7a8a1ae71d0c4e2d767f4d06f05890169b56 (diff) | |
| download | nginx-c9115e73d5663dcaf9f8c4302c14a2dea51cd667.tar.gz nginx-c9115e73d5663dcaf9f8c4302c14a2dea51cd667.tar.bz2 | |
r1594 merge:
unescape SSI include
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/ngx_string.c | 18 | ||||
| -rw-r--r-- | src/core/ngx_string.h | 17 |
2 files changed, 24 insertions, 11 deletions
diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c index 0385c9643..ad70fb3c9 100644 --- a/src/core/ngx_string.c +++ b/src/core/ngx_string.c @@ -1243,7 +1243,9 @@ ngx_unescape_uri(u_char **dst, u_char **src, size_t size, ngx_uint_t type) switch (state) { case sw_usual: - if (ch == '?' && type == NGX_UNESCAPE_URI) { + if (ch == '?' + && (type & (NGX_UNESCAPE_URI|NGX_UNESCAPE_REDIRECT))) + { *d++ = ch; goto done; } @@ -1286,7 +1288,7 @@ ngx_unescape_uri(u_char **dst, u_char **src, size_t size, ngx_uint_t type) if (ch >= '0' && ch <= '9') { ch = (u_char) ((decoded << 4) + ch - '0'); - if (type == NGX_UNESCAPE_URI) { + if (type & NGX_UNESCAPE_REDIRECT) { if (ch > '%' && ch < 0x7f) { *d++ = ch; break; @@ -1306,7 +1308,17 @@ ngx_unescape_uri(u_char **dst, u_char **src, size_t size, ngx_uint_t type) if (c >= 'a' && c <= 'f') { ch = (u_char) ((decoded << 4) + c - 'a' + 10); - if (type == NGX_UNESCAPE_URI) { + if (type & NGX_UNESCAPE_URI) { + if (ch == '?') { + *d++ = ch; + goto done; + } + + *d++ = ch; + break; + } + + if (type & NGX_UNESCAPE_REDIRECT) { if (ch == '?') { *d++ = ch; goto done; diff --git a/src/core/ngx_string.h b/src/core/ngx_string.h index f96795134..275c8db5e 100644 --- a/src/core/ngx_string.h +++ b/src/core/ngx_string.h @@ -155,14 +155,15 @@ size_t ngx_utf_length(u_char *p, size_t n); u_char *ngx_utf_cpystrn(u_char *dst, u_char *src, size_t n); -#define NGX_ESCAPE_URI 0 -#define NGX_ESCAPE_ARGS 1 -#define NGX_ESCAPE_HTML 2 -#define NGX_ESCAPE_REFRESH 3 -#define NGX_ESCAPE_MEMCACHED 4 -#define NGX_ESCAPE_MAIL_AUTH 5 - -#define NGX_UNESCAPE_URI 1 +#define NGX_ESCAPE_URI 0 +#define NGX_ESCAPE_ARGS 1 +#define NGX_ESCAPE_HTML 2 +#define NGX_ESCAPE_REFRESH 3 +#define NGX_ESCAPE_MEMCACHED 4 +#define NGX_ESCAPE_MAIL_AUTH 5 + +#define NGX_UNESCAPE_URI 1 +#define NGX_UNESCAPE_REDIRECT 2 uintptr_t ngx_escape_uri(u_char *dst, u_char *src, size_t size, ngx_uint_t type); |
