diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-05-12 02:50:38 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-05-12 02:50:38 +0100 |
commit | ebdfc8c271a48583994334b5e907546d87460f70 (patch) | |
tree | 8e5da0a30c19493dc78e8121d55013741dfe2d85 /net/http.lua | |
parent | d2e54407980844a76431f2b4f450606d2d710295 (diff) | |
download | prosody-ebdfc8c271a48583994334b5e907546d87460f70.tar.gz prosody-ebdfc8c271a48583994334b5e907546d87460f70.zip |
net.http: Fix urlencode to not encode unreserved characters, so I can guiltlessly rant about people who do.
Diffstat (limited to 'net/http.lua')
-rw-r--r-- | net/http.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/http.lua b/net/http.lua index 59f2c080..f2061e00 100644 --- a/net/http.lua +++ b/net/http.lua @@ -68,7 +68,7 @@ function listener.ondisconnect(conn, err) requests[conn] = nil; end -function urlencode(s) return s and (s:gsub("%W", function (c) return format("%%%02x", c:byte()); end)); end +function urlencode(s) return s and (s:gsub("[^a-zA-Z0-9.~_-]", function (c) return format("%%%02x", c:byte()); end)); end function urldecode(s) return s and (s:gsub("%%(%x%x)", function (c) return char(tonumber(c,16)); end)); end local function _formencodepart(s) |