diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2008-07-05 20:12:24 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2008-07-05 20:12:24 +0000 |
commit | 8fcbdb39feb7922a2a6b8bd5cf16aca90e93a624 (patch) | |
tree | d2549fb9f36aa4d46e366747e7b0cb18ddeb2f4e /libs/http | |
parent | bbe086c9ce76c6abbc26434462736bb8b42f2a6c (diff) |
* luci/libs: make treatment of "+" conditional in http.protocol ("+" should not be decoded by urldecode)
* luci/https: fix breakage introduced by "+" decoding
Diffstat (limited to 'libs/http')
-rw-r--r-- | libs/http/luasrc/http/protocol.lua | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libs/http/luasrc/http/protocol.lua b/libs/http/luasrc/http/protocol.lua index a187bed2e6..b8e9624495 100644 --- a/libs/http/luasrc/http/protocol.lua +++ b/libs/http/luasrc/http/protocol.lua @@ -23,14 +23,17 @@ HTTP_URLENC_MAXKEYLEN = 1024 -- maximum allowd size of urlencoded parameter nam -- Decode an urlencoded string. -- Returns the decoded value. -function urldecode( str ) +function urldecode( str, no_plus ) local function __chrdec( hex ) return string.char( tonumber( hex, 16 ) ) end if type(str) == "string" then - str = str:gsub( "+", " " ) + if not no_plus then + str = str:gsub( "+", " " ) + end + str = str:gsub( "%%([a-fA-F0-9][a-fA-F0-9])", __chrdec ) end |