[Zrouter-src] ZRouter.org: push to ZRouter profiles/lua_web_ui/files/etc/www/c...

zrouter-src at zrouter.org zrouter-src at zrouter.org
Tue Oct 16 10:30:45 UTC 2012


details:   http://zrouter.org/hg/zrouter//rev/7b87676ff72d
changeset: 484:7b87676ff72d
user:      Aleksandr Rybalko <ray at ddteam.net>
date:      Tue Oct 16 13:30:51 2012 +0300
description:
Use lib/urlXxcode.lua instead of local urlXXcode subs.

diffstat:

 profiles/lua_web_ui/files/etc/www/collector.lua |  28 +++++-------------------
 1 files changed, 6 insertions(+), 22 deletions(-)

diffs (46 lines):

diff -r b13d24c91eca -r 7b87676ff72d profiles/lua_web_ui/files/etc/www/collector.lua
--- a/profiles/lua_web_ui/files/etc/www/collector.lua	Tue Oct 16 13:11:48 2012 +0300
+++ b/profiles/lua_web_ui/files/etc/www/collector.lua	Tue Oct 16 13:30:51 2012 +0300
@@ -13,36 +13,18 @@
 serverhost = serverhost or "127.0.0.1";
 serverport = serverport or "80";
 
+-- read_file, tdump, xmldump, exec_output
+dofile('lib/utils.lua');
+
+-- urlEncode/urlDecode
+dofile("lib/urlXxcode.lua");
+
 -- Globals
 r = {};		-- Runtime varibles structure
 rquery = {};
 queue = {};
 local internet_led = nil;
 
---
--- Utility function:  URL encoding function
---
-function urlEncode(str)
-    if (str) then
-        str = string.gsub (str, "\n", "\r\n")
-        str = string.gsub (str, "([^%w ])",
-            function (c) return string.format ("%%%02X", string.byte(c)) end)
-        str = string.gsub (str, " ", "+")
-    end
-    return str
-end
-
-
---
--- Utility function:  URL decode function
---
-function urlDecode(str)
-    str = string.gsub (str, "+", " ")
-    str = string.gsub (str, "%%(%x%x)", function(h) return string.char(tonumber(h,16)) end)
-    str = string.gsub (str, "\r\n", "\n")
-    return str
-end
-
 -- convert name1=value1&name2=val+ue%2F2
 -- to table {"name1"="value1", "name2"="val ue/2"}
 function parse_query(query)


More information about the Zrouter-src mailing list