Skip to content

Commit

Permalink
updates from yunong feedback: move TODO to a ticket, prefer 'self.'
Browse files Browse the repository at this point in the history
  • Loading branch information
trentm committed Oct 18, 2016
1 parent 2c96411 commit ae78879
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lib/HttpClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,6 @@ function proxyOptsFromStr(str) {
}
var parsed = url.parse(s);

// TODO: proxyOpts.headers (see whitelisting of req headers by 'request'
// module).
var proxyOpts = {
protocol: parsed.protocol,
host: parsed.hostname
Expand Down Expand Up @@ -449,20 +447,20 @@ function HttpClient(options) {
// HTTP proxy: `options.proxy` wins, else `https_proxy`/`http_proxy` envvars
// (upper and lowercase) are used.
if (options.proxy === false) {
this.proxy = false;
self.proxy = false;
} else if (options.proxy) {
if (typeof (options.proxy) === 'string') {
this.proxy = proxyOptsFromStr(options.proxy);
self.proxy = proxyOptsFromStr(options.proxy);
} else {
assert.object(options.proxy, 'options.proxy');
this.proxy = options.proxy;
self.proxy = options.proxy;
}
} else {
// For backwards compat in restify 4.x and restify-clients 1.x, the
// `https_proxy` or `http_proxy` envvar will work for both HTTP and
// HTTPS. That behaviour may change in the next major version. See
// restify/node-restify#878 for details.
this.proxy = proxyOptsFromStr(process.env.https_proxy ||
self.proxy = proxyOptsFromStr(process.env.https_proxy ||
process.env.HTTPS_PROXY ||
process.env.http_proxy ||
process.env.HTTP_PROXY);
Expand All @@ -471,8 +469,8 @@ function HttpClient(options) {
var noProxy = (options.hasOwnProperty('noProxy') ? options.noProxy
: (process.env.NO_PROXY || process.env.no_proxy || null));

if (this.proxy && !isProxyForURL(noProxy, self.url)) {
this.proxy = false;
if (self.proxy && !isProxyForURL(noProxy, self.url)) {
self.proxy = false;
}

if (options.accept) {
Expand Down

0 comments on commit ae78879

Please sign in to comment.