diff --git a/exec/load/http.js b/exec/load/http.js index a4e11fbd7f2829f9aad68af6060fa09757923acc..1256f3dcd4400e0c8b411f3c1a80641fd1b928e5 100644 --- a/exec/load/http.js +++ b/exec/load/http.js @@ -75,6 +75,8 @@ function HTTPRequest(username,password) }; this.SendRequest=function() { + var i; + if((this.sock=new Socket(SOCK_STREAM))==null) throw("Unable to create socket"); if(!this.sock.connect(this.url.host, this.url.port?this.url.port:(this.url.scheme=='http'?80:443))) { @@ -170,4 +172,25 @@ function HTTPRequest(username,password) this.ReadResponse(); return(this.body); }; + + this.Head=function(url, referer, base) { + var i; + var m; + var ret={}; + + this.SetupGet(url,referer,base); + this.request = this.request.replace(/^GET/, 'HEAD'); + this.BasicAuth(); + this.SendRequest(); + this.ReadResponse(); + for(i in this.response_headers) { + m = this.response_headers[i].match(/^(.*?):\s*(.*?)\s*$/); + if (m) { + if (ret[m[1]] == undefined) + ret[m[1]] = []; + ret[m[1]].push(m[2]); + } + } + return(ret); + }; }