pe.timeout=function(){
if(arguments.length>4){return this;}
for(var i =0;i<arguments.length;i++){
if(!isNaN(arguments[i])){
this.timeout[i] = parseInt(arguments[i]);
}
}
return this;
};
_SmartHttp.prototype.send=function(){
this.init();
var _http = this.getobj();
if(_http==null){return this;}
try{
_http.setTimeouts(this.timeout[0], this.timeout, this.timeout, this.timeout);
}catch(ex){}
_http.open(this.method,this.url,false);
if(this.headers.length>0){
for(var i=0;i<this.headers.length;i++){
var Sindex = this.headers[i].indexOf(":");
var key = this.headers[i].substr(0,Sindex);
var value = this.headers[i].substr(Sindex+1);
_http.setRequestHeader(key,value);
}
}
_http.send(this.data);
this.readyState = _http.readyState;
if(_http.readyState==4){
this.status = parseInt(_http.status);
this.http = _http;
this.content = _http.responseBody;
}
return this;
}
_SmartHttp.prototype.getbinary=function(){
return this.content;
};
_SmartHttp.prototype.gettext=function(charset){
try{
return this.b2s(this.content,charset ? charset : this.charset);
}catch(ex){
this.msg = ex.description;
return "";
}
};
_SmartHttp.prototype.getjson=function(charset){
try{
var _json=null;
eval("_json=(" + this.gettext(charset) + ");");
return _json;
}catch(ex){
this.msg = ex.description;
return null;
}
};
_SmartHttp.prototype.getheader=function(key){
if(key){
if(key.toUpperCase()=="SET-COOKIE"){
key = key.replace("-","\-");
var headers = this.http.getAllResponseHeaders();
var regexp = new RegExp("\n" + key + "\:(.+?)\r","ig");
var resstr = "";
while((res = regexp.exec(headers))!=null){
var val = res.trim();
resstr = resstr + val.substr(0,val.indexOf(";")) + "; "
}
if(resstr!=""){
resstr = resstr.substr(0,resstr.lastIndexOf(";"));
}
return resstr;
}else{
return this.http.getResponseHeader(key);
}
}else{return this.http.getAllResponseHeaders();}
};
_SmartHttp.prototype.getxml=function(charset){
try{
var _dom = new ActiveXObject("MSXML2.DOMDocument");
_dom.loadXML(this.gettext(charset));
return _dom;
}catch(ex){
this.msg = ex.description;
return null;
}
};
_SmartHttp.prototype.getobj = function (){
var b=null;
var httplist = ["MSXML2.serverXMLHttp.3.0","MSXML2.serverXMLHttp","MSXML2.XMLHttp.3.0","MSXML2.XMLHttp","Microsoft.XMLHttp"];
for(var i = 0;i<=httplist.length -1;i++){
try{
b= new ActiveXObject(httplist[i]);
(function(o){
_SmartHttp.prototype.getobj = function(){return new ActiveXObject(o)};
})(httplist[i]);
return b;
}catch(ex){
eval("this.msg = ex.description;");
}
}
return b;
};
_SmartHttp.prototype.getrnd = function (){return Math.random().toString().substr(2);};
_SmartHttp.prototype.b2s = function(bytSource, Cset){ //ef bb bf,c0 fd
var Objstream,c1,c2,c3;
var byts;
Objstream =Server.CreateObject("ADODB.Stream");
Objstream.Type = 1;
Objstream.Mode = 3;
Objstream.Open();
Objstream.Write(bytSource);
Objstream.Position = 0;
Objstream.Type = 2;
Objstream.CharSet = Cset;
byts = Objstream.ReadText();
Objstream.Close();
Objstream = null;
return byts;
};
_SmartHttp.prot