Skip to content

Commit f170505

Browse files
hunterliagentzh
authored andcommitted
bugfix: ngx.escape_uri: we did not escape URI reserved chars. openresty#1124
ngx.escape_uri should also escape RFC 3986 section 2.2 Reserved Characters. Signed-off-by: Yichun Zhang (agentzh) <agentzh@gmail.com>
1 parent 0f0af50 commit f170505

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/ngx_http_lua_util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1852,7 +1852,7 @@ ngx_http_lua_escape_uri(u_char *dst, u_char *src, size_t size, ngx_uint_t type)
18521852
0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */
18531853

18541854
/* ?>=< ;:98 7654 3210 /.-, +*)( '&%$ #"! */
1855-
0xfc00987d, /* 1111 1100 0000 0000 1001 1000 0111 1101 */
1855+
0xfc009fff, /* 1111 1100 0000 0000 1001 1111 1111 1111 */
18561856

18571857
/* _^]\ [ZYX WVUT SRQP ONML KJIH GFED CBA@ */
18581858
0x78000001, /* 0111 1000 0000 0000 0000 0000 0000 0001 */

t/006-escape.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ GET /t
193193
--- request
194194
GET /lua
195195
--- response_body
196-
-_.!~*'()
196+
-_.%21~%2A%27%28%29
197197
%2C%24%40%7C%60
198198
--- no_error_log
199199
[error]

t/030-uri-args.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1403,6 +1403,6 @@ GET /lua
14031403
--- request
14041404
GET /lua
14051405
--- response_body
1406-
args: foo=%2C%24%40%7C%60&bar=-_.!~*'()
1406+
args: foo=%2C%24%40%7C%60&bar=-_.%21~%2A%27%28%29
14071407
--- no_error_log
14081408
[error]

0 commit comments

Comments
 (0)