pac-proxy-agent
Advanced tools
Comparing version 0.1.0 to 0.1.1
0.1.1 / 2014-02-03 | ||
================== | ||
* index: move the exports before the `require()` calls | ||
* index: minor code cleanup | ||
* index: better proxy string splitting logic | ||
0.1.0 / 2014-01-25 | ||
@@ -3,0 +10,0 @@ ================== |
53
index.js
/** | ||
* Module exports. | ||
* | ||
* XXX: exports going first here so that the circular require with | ||
* `proxy-agent` doesn't result in an empty `exports` object for | ||
* this module when `proxy-agent` requires us. | ||
*/ | ||
module.exports = exports = PacProxyAgent; | ||
/** | ||
* Supported "protocols". Delegates out to the `get-uri` module. | ||
*/ | ||
var getUri = require('get-uri'); | ||
Object.defineProperty(exports, 'protocols', { | ||
enumerable: true, | ||
configurable: true, | ||
get: function () { return Object.keys(getUri.protocols); } | ||
}); | ||
/** | ||
* Module dependencies. | ||
@@ -12,3 +33,2 @@ */ | ||
var extend = require('extend'); | ||
var getUri = require('get-uri'); | ||
var Agent = require('agent-base'); | ||
@@ -22,18 +42,2 @@ var ProxyAgent = require('proxy-agent'); | ||
/** | ||
* Module exports. | ||
*/ | ||
module.exports = exports = PacProxyAgent; | ||
/** | ||
* Supported "protocols". Delegates out to the `get-uri` module. | ||
*/ | ||
Object.defineProperty(exports, 'protocols', { | ||
enumerable: true, | ||
configurable: true, | ||
get: function () { return Object.keys(getUri.protocols); } | ||
}); | ||
/** | ||
* The `PacProxyAgent` class. | ||
@@ -197,3 +201,3 @@ * | ||
// XXX: need to use `hostname` instead of `host` otherwise `port` is ignored | ||
// need to use `hostname` instead of `host` otherwise `port` is ignored | ||
hostname: opts.host, | ||
@@ -220,3 +224,3 @@ host: null, | ||
var proxies = proxy.split(/;\s*?\b/); | ||
var proxies = String(proxy).trim().split(/\b\s*;\s*?\b/); | ||
@@ -227,10 +231,11 @@ // XXX: right now, only the first proxy specified will be used | ||
var agent; | ||
var parts = first.split(/\s+/); | ||
var type = parts[0]; | ||
var agent; | ||
var secure = self.secureEndpoint; | ||
if ('DIRECT' == type) { | ||
// direct connection to the destionation endpoint | ||
// direct connection to the destination endpoint | ||
var socket; | ||
if (self.secureEndpoint) { | ||
if (secure) { | ||
socket = tls.connect(opts); | ||
@@ -243,6 +248,6 @@ } else { | ||
// use an HTTP proxy | ||
agent = ProxyAgent('http://' + parts[1], self.secureEndpoint); | ||
agent = ProxyAgent('http://' + parts[1], secure); | ||
} else if ('SOCKS' == type) { | ||
// use a SOCKS proxy | ||
agent = ProxyAgent('socks://' + parts[1], self.secureEndpoint); | ||
agent = ProxyAgent('socks://' + parts[1], secure); | ||
} | ||
@@ -249,0 +254,0 @@ if (agent) agent.callback(req, opts, fn); |
{ | ||
"name": "pac-proxy-agent", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A PAC file proxy `http.Agent` implementation for HTTP", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12282
230