From 45326136c4487ed62075729bffed6f7f57ab9a69 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 9 Apr 2013 15:50:46 +0200 Subject: prosodyctl: Bump util.pposix version for API change --- prosodyctl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prosodyctl b/prosodyctl index 71b99f9e..24d28157 100755 --- a/prosodyctl +++ b/prosodyctl @@ -135,7 +135,7 @@ dependencies.log_warnings(); -- Switch away from root and into the prosody user -- local switched_user, current_uid; -local want_pposix_version = "0.3.5"; +local want_pposix_version = "0.3.6"; local ok, pposix = pcall(require, "util.pposix"); if ok and pposix then -- cgit v1.2.3 From bc590ea5dcb5863b026659aaebe6ef0e61930ff7 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 12 Apr 2013 20:26:35 +0100 Subject: util.http: Refactor and import all necessary functions --- util/http.lua | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/util/http.lua b/util/http.lua index 5dd636d9..f7259920 100644 --- a/util/http.lua +++ b/util/http.lua @@ -5,12 +5,14 @@ -- COPYING file in the source package for more information. -- -local http = {}; +local format, char = string.format, string.char; +local pairs, ipairs, tonumber = pairs, ipairs, tonumber; +local t_insert, t_concat = table.insert, table.concat; -function http.urlencode(s) +local function urlencode(s) return s and (s:gsub("[^a-zA-Z0-9.~_-]", function (c) return format("%%%02x", c:byte()); end)); end -function http.urldecode(s) +local function urldecode(s) return s and (s:gsub("%%(%x%x)", function (c) return char(tonumber(c,16)); end)); end @@ -24,7 +26,7 @@ local function _formencodepart(s) end)); end -function http.formencode(form) +local function formencode(form) local result = {}; if form[1] then -- Array of ordered { name, value } for _, field in ipairs(form) do @@ -38,7 +40,7 @@ function http.formencode(form) return t_concat(result, "&"); end -function http.formdecode(s) +local function formdecode(s) if not s:match("=") then return urldecode(s); end local r = {}; for k, v in s:gmatch("([^=&]*)=([^&]*)") do @@ -50,11 +52,13 @@ function http.formdecode(s) return r; end -function http.contains_token(field, token) +local function contains_token(field, token) field = ","..field:gsub("[ \t]", ""):lower()..","; return field:find(","..token:lower()..",", 1, true) ~= nil; end - - -return http; +return { + urlencode = urlencode, urldecode = urldecode; + formencode = formencode, formdecode = formdecode; + contains_token = contains_token; +}; -- cgit v1.2.3 From 0e656606c0200da0f0b35df4bd827245a2828fa7 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Mon, 15 Apr 2013 12:30:40 +0100 Subject: Makefile: Specify explicit mode when installing prosody.version, to avoid it defaulting to something nasty (executable) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0e69192a..b96b6732 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ install: prosody.install prosodyctl.install prosody.cfg.lua.install util/encodin install -m644 certs/* $(CONFIG)/certs install -m644 man/prosodyctl.man $(MAN)/man1/prosodyctl.1 test -e $(CONFIG)/prosody.cfg.lua || install -m644 prosody.cfg.lua.install $(CONFIG)/prosody.cfg.lua - test -e prosody.version && install prosody.version $(SOURCE)/prosody.version || true + test -e prosody.version && install -m644 prosody.version $(SOURCE)/prosody.version || true $(MAKE) install -C util-src clean: -- cgit v1.2.3