Browse files

Make HTTP agent configurable.

  • Loading branch information...
1 parent d67090c commit 246332907f28b2221368ec60a09ffc8d1fc7547a Will White committed Sep 14, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 lib/node-get/node-get.js
View
3 lib/node-get/node-get.js
@@ -65,6 +65,7 @@ function Get(options) {
} else {
this.proxy = {};
}
+ this.agent = options.agent || undefined;
}
}
@@ -89,6 +90,7 @@ Get.prototype.request = function(callback) {
// TODO: should pronode-getxies support HTTPS?
if (this.uri_o.protocol == 'https:') {
return https.request({
+ agent: this.agent,
host: this.uri_o.hostname,
port: 443,
headers: this.headers,
@@ -100,6 +102,7 @@ Get.prototype.request = function(callback) {
}, callback);
} else {
return http.request({
+ agent: this.agent,
port: this.proxy.port || this.uri_o.port || 80,
host: this.proxy.hostname || this.uri_o.hostname,
headers: this.headers,

0 comments on commit 2463329

Please sign in to comment.