"use strict";(function(){"use strict";var e=require("http");var o=null;exports.Base64={encode:function t(e){return new Buffer(e).toString("base64")},decode:function r(e){new Buffer(e,"base64").toString("ascii")}};exports.init=function(){o=null};function n(n,t,r){o=n.ip?n.ip:o;console.log("post host opt.ip, commandIP",n.ip,o);n.host=o;n.headers=n.headers||{};if(t){n.headers["Content-Length"]=t.length}if(global.RUIJIEID){n.headers["Cookie"]="RUIJIEID="+global.RUIJIEID}if(global.SID){n.headers["Cookie"]="SID="+global.SID}if(!global.RUIJIEID&&global.SID){n.headers["Cookie"]="RUIJIEID="+global.SID}console.debug("cookie SID,RUIJIEID,header.cookie:",global.SID,global.RUIJIEID,n.headers["Cookie"]);var i=function a(e){e.setEncoding("utf-8");var o=[];e.on("data",function(e){o.push(e)}).on("end",function(){var n=require("xml2js").parseString;n(o,{explicitArray:false},function(o,n){r&&r(n,e)})})};var s=e.request(n,i).on("error",function(e){console.error(e.message);r&&r(null,e.message)});if(t){s.write(t)}s.end()}exports.post=function(e,o,t){e.method="POST";return n(e,o,t)};exports.get=function(e,o){e.method="GET";return n(e,null,o)}})();