@@ -376,8 +376,10 @@ ngx_http_lua_new_thread(ngx_http_request_t *r, lua_State *L, int *ref)
376376 if (!lua_isnil (L , -1 ) && !lua_isnil (L , -2 )) {
377377 n ++ ;
378378 }
379+
379380 lua_pop (L , 1 );
380381 }
382+
381383 lua_pop (L , 1 );
382384
383385 ngx_log_debug3 (NGX_LOG_DEBUG_HTTP , r -> connection -> log , 0 ,
@@ -2199,6 +2201,7 @@ ngx_http_lua_escape_uri(u_char *dst, u_char *src, size_t size, ngx_uint_t type)
21992201 return (uintptr_t ) dst ;
22002202}
22012203
2204+
22022205static int
22032206ngx_http_lua_util_hex2int (char xdigit )
22042207{
@@ -2214,14 +2217,15 @@ ngx_http_lua_util_hex2int(char xdigit)
22142217 return -1 ;
22152218}
22162219
2220+
22172221/* XXX we also decode '+' to ' ' */
22182222void
22192223ngx_http_lua_unescape_uri (u_char * * dst , u_char * * src , size_t size ,
22202224 ngx_uint_t type )
22212225{
2222- u_char * d = * dst , * s = * src , * de = (* dst + size );
2223- int isuri = type & NGX_UNESCAPE_URI ;
2224- int isredirect = type & NGX_UNESCAPE_REDIRECT ;
2226+ u_char * d = * dst , * s = * src , * de = (* dst + size );
2227+ int isuri = type & NGX_UNESCAPE_URI ;
2228+ int isredirect = type & NGX_UNESCAPE_REDIRECT ;
22252229
22262230 while (size -- ) {
22272231 u_char curr = * s ++ ;
@@ -2245,10 +2249,12 @@ ngx_http_lua_unescape_uri(u_char **dst, u_char **src, size_t size,
22452249 if ((isuri || isredirect ) && ch == '?' ) {
22462250 * d ++ = ch ;
22472251 break ;
2252+
22482253 } else if (isredirect && (ch <= '%' || ch >= 0x7f )) {
22492254 * d ++ = '%' ;
22502255 continue ;
22512256 }
2257+
22522258 * d ++ = ch ;
22532259 s += 2 ;
22542260 size -= 2 ;
0 commit comments