* lua_ap_unescape; r:unescape(string) - Unescapes an URL-encoded string */
| 910 | * lua_ap_unescape; r:unescape(string) - Unescapes an URL-encoded string |
| 911 | */ |
| 912 | static int lua_ap_unescape(lua_State *L) |
| 913 | { |
| 914 | const char *escaped; |
| 915 | char *plain; |
| 916 | size_t x, |
| 917 | y; |
| 918 | request_rec *r; |
| 919 | r = ap_lua_check_request_rec(L, 1); |
| 920 | luaL_checktype(L, 2, LUA_TSTRING); |
| 921 | escaped = lua_tolstring(L, 2, &x); |
| 922 | plain = apr_pstrdup(r->pool, escaped); |
| 923 | y = ap_unescape_urlencoded(plain); |
| 924 | if (!y) { |
| 925 | lua_pushstring(L, plain); |
| 926 | return 1; |
| 927 | } |
| 928 | return 0; |
| 929 | } |
| 930 | |
| 931 | /* |
| 932 | * lua_ap_escape; r:escape(string) - URL-escapes a string |
nothing calls this directly
no test coverage detected