diff --git a/lib/XMLHttpRequest.js b/lib/XMLHttpRequest.js index 183e8eb..e0f4071 100644 --- a/lib/XMLHttpRequest.js +++ b/lib/XMLHttpRequest.js @@ -15,7 +15,11 @@ var Url = require("url") , spawn = require("child_process").spawn , fs = require('fs'); -exports.XMLHttpRequest = function() { + /** + * + * @param http.Agent agent An http.Agent instance; http.globalAgent may be used; if 'undefined', agent usage is disabled; (optional) + */ +exports.XMLHttpRequest = function(agent) { /** * Private variables */ @@ -97,6 +101,8 @@ exports.XMLHttpRequest = function() { * Public vars */ + this.agent = agent || false; + // Current state this.readyState = this.UNSENT; @@ -359,7 +365,7 @@ exports.XMLHttpRequest = function() { path: uri, method: settings.method, headers: headers, - agent: false + agent: this.agent }; // Reset error flag