Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pac-proxy-agent

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pac-proxy-agent - npm Package Compare versions

Comparing version 0.0.2 to 0.1.0

9

History.md
0.1.0 / 2014-01-25
==================
* index: calculate an SHA1 hash of the JS code
* index: pass the `sandbox` option in to PacResolver
* index: remove final remnants of the `code` property
* index: set the `filename` option when creating the resolver function
* package: update to "pac-resolver" v1.1.0
0.0.2 / 2014-01-25

@@ -3,0 +12,0 @@ ==================

41

index.js

@@ -8,2 +8,3 @@

var tls = require('tls');
var crypto = require('crypto');
var parse = require('url').parse;

@@ -48,5 +49,2 @@ var format = require('url').format;

*
* Or you can pass the PAC file JS code directly as a `code` param in the options
* object.
*
* @api public

@@ -76,11 +74,5 @@ */

this.sandbox = opts.sandox;
this.cache = this._resolver = null;
/*
if (opts.code) {
// the JS code was passed directly in
protocol = 'code';
this.code = opts.code;
}
*/
}

@@ -101,6 +93,6 @@ inherits(PacProxyAgent, Agent);

// kick things off by attempting to (re)load the contents of the PAC file URI
this.loadPacFile(onPacFile);
this.loadPacFile(onpacfile);
// loadPacFile() callback function
function onPacFile (err, code) {
function onpacfile (err, code) {
if (err) {

@@ -116,5 +108,22 @@ if ('ENOTMODIFIED' == err.code) {

// create a sha1 hash of the JS code
var hash = crypto.createHash('sha1').update(code).digest('hex');
if (self._resolver && self._resolver.hash == hash) {
debug('same sha1 hash for code - contents have not changed, reusing previous proxy resolver');
fn(null, self._resolver);
return;
}
// cache the resolver
debug('creating new proxy resolver instance');
self._resolver = new PacResolver(code);
self._resolver = new PacResolver(code, {
filename: self.uri,
sandbox: self.sandbox
});
// store that sha1 hash on the resolver instance
// for future comparison purposes
self._resolver.hash = hash;
fn(null, self._resolver);

@@ -209,2 +218,6 @@ }

if (err) return fn(err);
// default to "DIRECT" if a falsey value was returned (or nothing)
if (!proxy) proxy = 'DIRECT';
var proxies = proxy.split(/;\s*?\b/);

@@ -211,0 +224,0 @@

{
"name": "pac-proxy-agent",
"version": "0.0.2",
"version": "0.1.0",
"description": "A PAC file proxy `http.Agent` implementation for HTTP",

@@ -32,3 +32,3 @@ "main": "index.js",

"extend": "~1.2.1",
"pac-resolver": "~0.0.2",
"pac-resolver": "~1.1.0",
"proxy-agent": "1",

@@ -35,0 +35,0 @@ "get-uri": "~0.1.0",

@@ -12,2 +12,3 @@ pac-proxy-agent

Installation

@@ -14,0 +15,0 @@ ------------

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc