Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added Agent Support #15

Open
wants to merge 5 commits into from

2 participants

@lgtml

Added support for passing agent.

Notes to reviewer

This allows us to pass in a tunnel agent for proxy support or use a shared http agent with other modules.

@gabipetrovay

This might be related with the pull request I just made: "Configuration Options" documentation and "headers" configuration

@lgtml

The proxy support within the module was broken if I recall, this allows us to abstract the proxy support out to a proxy connect agent(tunnel module) which we can then share between modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 4, 2013
  1. removed proxy directive

    Leigh Martell authored
  2. added agent support

    Leigh Martell authored
  3. added agent comment

    Leigh Martell authored
  4. opps I fixed it again

    Leigh Martell authored
  5. Merge pull request #1 from goinstant/leighmartell/add-agent

    leighmartell authored
    Ian says LGTM
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 5 deletions.
  1. +3 −5 index.js
View
8 index.js
@@ -611,10 +611,6 @@ var Client = module.exports = function(config) {
var protocol = this.config.protocol || this.constants.protocol || "http";
var host = this.config.host || this.constants.host;
var port = this.config.port || this.constants.port || (protocol == "https" ? 443 : 80);
- if (this.config.proxy) {
- host = this.config.proxy.host;
- port = this.config.proxy.port || 3128;
- }
var headers = {
"host": host,
@@ -651,12 +647,14 @@ var Client = module.exports = function(config) {
}
}
+ //Note that agent defaults for globalAgent if undefined so we don't need extra magic
var options = {
host: host,
port: port,
path: path,
method: method,
- headers: headers
+ headers: headers,
+ agent: this.config.agent || undefined
};
if (this.debug)
Something went wrong with that request. Please try again.