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 | 7e6b8c8f267f41b77627b1c2bab0d9918efb9498 (patch) | |
tree | 8e5da0a30c19493dc78e8121d55013741dfe2d85 | |
parent | c0c107c9e93f4a694e1536c6a94dbb1455b0159c (diff) | |
download | prosody-7e6b8c8f267f41b77627b1c2bab0d9918efb9498.tar.gz prosody-7e6b8c8f267f41b77627b1c2bab0d9918efb9498.zip |
net.http: Fix urlencode to not encode unreserved characters, so I can guiltlessly rant about people who do.
-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) |