Skip to content

Commit

Permalink
bugfix: ngx.escape_uri() now uses uppercase hexadecimal digits for pe…
Browse files Browse the repository at this point in the history
…rcent-encoding according to the recommendation in RFC 3986. thanks Piotr Sikora for the suggestion.
  • Loading branch information
agentzh committed Jul 9, 2014
1 parent 5e94463 commit 34ecd2f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/ngx_http_lua_util.c
Expand Up @@ -1769,7 +1769,7 @@ ngx_http_lua_escape_uri(u_char *dst, u_char *src, size_t size, ngx_uint_t type)
{
ngx_uint_t n;
uint32_t *escape;
static u_char hex[] = "0123456789abcdef";
static u_char hex[] = "0123456789ABCDEF";

/* " ", "#", "%", "?", %00-%1F, %7F-%FF */

Expand Down
8 changes: 4 additions & 4 deletions t/006-escape.t
Expand Up @@ -23,7 +23,7 @@ __DATA__
--- request
GET /escape
--- response_body
a%20%e4%bd%a0
a%20%E4%BD%A0
Expand All @@ -48,7 +48,7 @@ a 你
--- request
GET /escape
--- response_body
a%20%e4%bd%a0
a%20%E4%BD%A0
Expand All @@ -73,7 +73,7 @@ a 你
--- request
GET /escape
--- response_body
a%2bb
a%2Bb
Expand All @@ -86,7 +86,7 @@ a%2bb
--- request
GET /escape
--- response_body
%22a%2fb%3d%7b%7d%3a%3c%3e%3b%26%5b%5d%5c%5e
%22a%2Fb%3D%7B%7D%3A%3C%3E%3B%26%5B%5D%5C%5E
Expand Down
6 changes: 3 additions & 3 deletions t/020-subrequest.t
Expand Up @@ -461,7 +461,7 @@ GET /lua
--- request
GET /lua
--- response_body
fo%3d=%3d%3e
fo%3D=%3D%3E
--- no_error_log
[error]
Expand All @@ -484,7 +484,7 @@ fo%3d=%3d%3e
--- request
GET /lua
--- response_body_like chop
^(?:fo%3d=%3d%3e\&%3d=%3a|%3d=%3a\&fo%3d=%3d%3e)$
^(?:fo%3D=%3D%3E\&%3D=%3A|%3D=%3A\&fo%3D=%3D%3E)$
--- no_error_log
[error]
--- no_error_log
Expand Down Expand Up @@ -1128,7 +1128,7 @@ hello world
--- request
GET /t?r[]=http%3A%2F%2Fajax.googleapis.com%3A80%2Fajax%2Flibs%2Fjquery%2F1.7.2%2Fjquery.min.js&r[]=http%3A%2F%2Fajax.googleapis.com%3A80%2Fajax%2Flibs%2Fdojo%2F1.7.2%2Fdojo%2Fdojo.js.uncompressed.js
--- response_body
r%5b%5d=http%3a%2f%2fajax.googleapis.com%3a80%2fajax%2flibs%2fjquery%2f1.7.2%2fjquery.min.js&r%5b%5d=http%3a%2f%2fajax.googleapis.com%3a80%2fajax%2flibs%2fdojo%2f1.7.2%2fdojo%2fdojo.js.uncompressed.js
r%5B%5D=http%3A%2F%2Fajax.googleapis.com%3A80%2Fajax%2Flibs%2Fjquery%2F1.7.2%2Fjquery.min.js&r%5B%5D=http%3A%2F%2Fajax.googleapis.com%3A80%2Fajax%2Flibs%2Fdojo%2F1.7.2%2Fdojo%2Fdojo.js.uncompressed.js
--- no_error_log
[error]
Expand Down
4 changes: 2 additions & 2 deletions t/023-rewrite/subrequest.t
Expand Up @@ -447,7 +447,7 @@ GET /lua
--- request
GET /lua
--- response_body
fo%3d=%3d%3e
fo%3D=%3D%3E
Expand All @@ -469,7 +469,7 @@ fo%3d=%3d%3e
--- request
GET /lua
--- response_body_like chop
^(?:fo%3d=%3d%3e\&%3d=%3a|%3d=%3a\&fo%3d=%3d%3e)$
^(?:fo%3D=%3D%3E\&%3D=%3A|%3D=%3A\&fo%3D=%3D%3E)$
Expand Down
4 changes: 2 additions & 2 deletions t/024-access/subrequest.t
Expand Up @@ -447,7 +447,7 @@ GET /lua
--- request
GET /lua
--- response_body
fo%3d=%3d%3e
fo%3D=%3D%3E
Expand All @@ -469,7 +469,7 @@ fo%3d=%3d%3e
--- request
GET /lua
--- response_body_like chop
^(?:fo%3d=%3d%3e\&%3d=%3a|%3d=%3a\&fo%3d=%3d%3e)$
^(?:fo%3D=%3D%3E\&%3D=%3A|%3D=%3A\&fo%3D=%3D%3E)$
Expand Down

0 comments on commit 34ecd2f

Please sign in to comment.