diff --git a/lib/http.js b/lib/http.js index f2eab84..c15e05d 100644 --- a/lib/http.js +++ b/lib/http.js @@ -15,7 +15,7 @@ var HTTPObject = function(engine) { this.headers = {}; this.parameters = {}; this.dataType = null; - this.userAgent = "WelsonJS/0.1.4-dev (https://github.com/gnh1201/welsonjs)"; + this.userAgent = "WelsonJS/0.2.3-dev (https://github.com/gnh1201/welsonjs)"; this.isAsync = false; this.proxy = { "enabled": false, @@ -48,6 +48,7 @@ var HTTPObject = function(engine) { password: "" }; this.isFollowRedirect = true; + this.saveTo = ''; this.create = function() { if (this.engine == "MSXML") { @@ -454,6 +455,11 @@ var HTTPObject = function(engine) { } } + // if it is download + cmd.push("-o"); + cmd.push(this.saveTo); + + // set the URL cmd.push(state.url); // Get response text @@ -632,6 +638,10 @@ var HTTPObject = function(engine) { return this; }; + this.setSaveTo = function(filename) { + this.saveTo = filename; + }; + this.create(); };