changeset 484:7b87676ff72d

Use lib/urlXxcode.lua instead of local urlXXcode subs.
author Aleksandr Rybalko <ray@ddteam.net>
date Tue, 16 Oct 2012 13:30:51 +0300
parents b13d24c91eca
children 685ec09f3772 5616a3d38d8e
files profiles/lua_web_ui/files/etc/www/collector.lua
diffstat 1 files changed, 6 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- 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)