luci-base: urlencode: encode all except unreserved characters.
authorYousong Zhou <yszhou4tech@gmail.com>
Tue, 26 Aug 2014 03:02:16 +0000 (11:02 +0800)
committerYousong Zhou <yszhou4tech@gmail.com>
Tue, 3 Nov 2015 09:07:45 +0000 (17:07 +0800)
As per http://tools.ietf.org/html/rfc3986#section-2.3

   Characters that are allowed in a URI but do not have a reserved
   purpose are called unreserved.  These include uppercase and lowercase
   letters, decimal digits, hyphen, period, underscore, and tilde.

      unreserved  = ALPHA / DIGIT / "-" / "." / "_" / "~"

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
modules/luci-base/luasrc/http/protocol.lua

index 859272679fa3d3b2c5dc693a718616909c9c9d51..0cb62aeec9dc60f909c181de2c8ea482db2d0a07 100644 (file)
@@ -72,7 +72,7 @@ function urlencode( str )
 
        if type(str) == "string" then
                str = str:gsub(
-                       "([^a-zA-Z0-9$_%-%.!*'(),])",
+                       "([^a-zA-Z0-9$_%-%.%~])",
                        __chrenc
                )
        end