diff options
Diffstat (limited to 'deps/npm/node_modules/pacote')
24 files changed, 818 insertions, 111 deletions
diff --git a/deps/npm/node_modules/pacote/CHANGELOG.md b/deps/npm/node_modules/pacote/CHANGELOG.md index 55c0cda686..7f7eac282d 100644 --- a/deps/npm/node_modules/pacote/CHANGELOG.md +++ b/deps/npm/node_modules/pacote/CHANGELOG.md @@ -2,6 +2,100 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +<a name="2.7.30"></a> +## [2.7.30](https://github.com/zkat/pacote/compare/v2.7.29...v2.7.30) (2017-06-05) + + +### Bug Fixes + +* **ssri:** bump ssri for bugfix ([70a859c](https://github.com/zkat/pacote/commit/70a859c)) + + + +<a name="2.7.29"></a> +## [2.7.29](https://github.com/zkat/pacote/compare/v2.7.28...v2.7.29) (2017-06-05) + + +### Bug Fixes + +* **registry:** use cert instead of certfile opt ([a45880d](https://github.com/zkat/pacote/commit/a45880d)) + + + +<a name="2.7.28"></a> +## [2.7.28](https://github.com/zkat/pacote/compare/v2.7.27...v2.7.28) (2017-06-05) + + +### Bug Fixes + +* **git:** limit ls-remote output to heads/tags (#97) ([c1e3dcd](https://github.com/zkat/pacote/commit/c1e3dcd)) +* **proxy:** send certificate authority, key and other options (#95) ([c4b6128](https://github.com/zkat/pacote/commit/c4b6128)) +* **registry:** add support for global auth and _auth token (#96) ([7919fb7](https://github.com/zkat/pacote/commit/7919fb7)) +* **registry:** emit npm-session header (#98) ([9816b18](https://github.com/zkat/pacote/commit/9816b18)) + + + +<a name="2.7.27"></a> +## [2.7.27](https://github.com/zkat/pacote/compare/v2.7.26...v2.7.27) (2017-06-01) + + +### Bug Fixes + +* **git:** fix semver range detection. oops ([76d9233](https://github.com/zkat/pacote/commit/76d9233)) + + + +<a name="2.7.26"></a> +## [2.7.26](https://github.com/zkat/pacote/compare/v2.7.25...v2.7.26) (2017-06-01) + + +### Bug Fixes + +* **git:** hash was not being replaced/appended correctly ([6fcbed5](https://github.com/zkat/pacote/commit/6fcbed5)) + + + +<a name="2.7.25"></a> +## [2.7.25](https://github.com/zkat/pacote/compare/v2.7.24...v2.7.25) (2017-05-31) + + +### Bug Fixes + +* **git:** git deps were getting _resolved without shasums ([96f0675](https://github.com/zkat/pacote/commit/96f0675)) + + + +<a name="2.7.24"></a> +## [2.7.24](https://github.com/zkat/pacote/compare/v2.7.23...v2.7.24) (2017-05-31) + + +### Bug Fixes + +* **deps:** update dep versions with new patches ([dc2e4ff](https://github.com/zkat/pacote/commit/dc2e4ff)) + + + +<a name="2.7.23"></a> +## [2.7.23](https://github.com/zkat/pacote/compare/v2.7.22...v2.7.23) (2017-05-31) + + +### Bug Fixes + +* **git:** fix ls-remote command and throw away ^{} junk ([62ba84d](https://github.com/zkat/pacote/commit/62ba84d)) +* **git:** use the parsed git committish from npa ([77a676a](https://github.com/zkat/pacote/commit/77a676a)) + + + +<a name="2.7.22"></a> +## [2.7.22](https://github.com/zkat/pacote/compare/v2.7.21...v2.7.22) (2017-05-31) + + +### Bug Fixes + +* **git:** accept shortened git hashes (#91) ([4466388](https://github.com/zkat/pacote/commit/4466388)) + + + <a name="2.7.21"></a> ## [2.7.21](https://github.com/zkat/pacote/compare/v2.7.20...v2.7.21) (2017-05-25) diff --git a/deps/npm/node_modules/pacote/lib/fetchers/git.js b/deps/npm/node_modules/pacote/lib/fetchers/git.js index d8af769364..9da6a6438a 100644 --- a/deps/npm/node_modules/pacote/lib/fetchers/git.js +++ b/deps/npm/node_modules/pacote/lib/fetchers/git.js @@ -15,7 +15,6 @@ const PassThrough = require('stream').PassThrough const path = require('path') const pipe = BB.promisify(require('mississippi').pipe) const rimraf = BB.promisify(require('rimraf')) -const semver = require('semver') const uniqueFilename = require('unique-filename') // `git` dependencies are fetched from git repositories and packed up. @@ -50,7 +49,7 @@ Fetcher.impl(fetchGit, { opts = optCheck(opts) let streamError const stream = new PassThrough().on('error', e => { streamError = e }) - const cacheName = manifest._resolved || spec.saveSpec || spec.fetchSpec + const cacheName = manifest._uniqueResolved || manifest._resolved || '' const cacheStream = ( opts.cache && cacache.get.stream( @@ -69,11 +68,9 @@ Fetcher.impl(fetchGit, { manifest._repo, manifest._ref, manifest._rawRef, tmp, opts ).then(HEAD => { if (streamError) { throw streamError } - if (!manifest._resolved) { - manifest._resolved = spec.saveSpec.replace(/#.*/, `#${HEAD}`) - manifest._uniqueResolved = manifest._resolved - } - return packDir(manifest, cacheName, tmp, stream, opts) + manifest._resolved = spec.saveSpec.replace(/(:?#.*)?$/, `#${HEAD}`) + manifest._uniqueResolved = manifest._resolved + return packDir(manifest, manifest._uniqueResolved, tmp, stream, opts) }) }).catch(err => stream.emit('error', err)) } @@ -102,9 +99,9 @@ function hostedManifest (spec, opts) { } function plainManifest (repo, spec, opts) { - const rawRef = spec.gitCommittish + const rawRef = spec.gitCommittish || spec.gitRange return resolve( - repo, rawRef, spec.name, opts + repo, spec, spec.name, opts ).then(ref => { if (ref) { const resolved = spec.saveSpec.replace(/(?:#.*)?$/, `#${ref.sha}`) @@ -113,7 +110,7 @@ function plainManifest (repo, spec, opts) { _resolved: resolved, _spec: spec, _ref: ref, - _rawRef: rawRef, + _rawRef: spec.gitCommittish || spec.gitRange, _uniqueResolved: resolved } } else { @@ -132,19 +129,18 @@ function plainManifest (repo, spec, opts) { }) } -function resolve (url, rawRef, name, opts) { - const semverMatch = rawRef.match(/^semver:v?(.*)/) - const isSemver = semverMatch && semver.validRange(semverMatch[1]) +function resolve (url, spec, name, opts) { + const isSemver = !!spec.gitRange return git.revs(url, opts).then(remoteRefs => { return isSemver ? pickManifest({ versions: remoteRefs.versions, 'dist-tags': remoteRefs['dist-tags'], name: name - }, semverMatch[1], opts) + }, spec.gitRange, opts) : remoteRefs ? BB.resolve( - remoteRefs.refs[rawRef] || remoteRefs.refs[remoteRefs.shas[rawRef]] + remoteRefs.refs[spec.gitCommittish] || remoteRefs.refs[remoteRefs.shas[spec.gitCommittish]] ) : null }) diff --git a/deps/npm/node_modules/pacote/lib/fetchers/registry/fetch.js b/deps/npm/node_modules/pacote/lib/fetchers/registry/fetch.js index 46a926a1a1..1c6c8e8d6e 100644 --- a/deps/npm/node_modules/pacote/lib/fetchers/registry/fetch.js +++ b/deps/npm/node_modules/pacote/lib/fetchers/registry/fetch.js @@ -16,14 +16,19 @@ function regFetch (uri, registry, opts) { algorithms: opts.algorithms, cache: getCacheMode(opts), cacheManager: opts.cache, + ca: opts.ca, + cert: opts.cert, headers: getHeaders(uri, registry, opts), integrity: opts.integrity, + key: opts.key, + localAddress: opts.localAddress, memoize: opts.memoize, noProxy: opts.noProxy, Promise: BB, proxy: opts.proxy, referer: opts.refer, retry: opts.retry, + strictSSL: !!opts.strictSSL, timeout: opts.timeout, uid: opts.uid, gid: opts.gid @@ -74,13 +79,15 @@ function getHeaders (uri, registry, opts) { const headers = Object.assign({ 'npm-in-ci': opts.isFromCI, 'npm-scope': opts.projectScope, + 'npm-session': opts.npmSession, 'user-agent': opts.userAgent, 'referer': opts.refer }, opts.headers) - const auth = ( + // check for auth settings specific to this registry + let auth = ( opts.auth && opts.auth[registryKey(registry)] - ) + ) || opts.auth // If a tarball is hosted on a different place than the manifest, only send // credentials on `alwaysAuth` const shouldAuth = auth && ( @@ -94,6 +101,8 @@ function getHeaders (uri, registry, opts) { `${auth.username}:${auth.password}`, 'utf8' ).toString('base64') headers.authorization = `Basic ${encoded}` + } else if (shouldAuth && auth._auth) { + headers.authorization = `Basic ${auth._auth}` } return headers } diff --git a/deps/npm/node_modules/pacote/lib/util/git.js b/deps/npm/node_modules/pacote/lib/util/git.js index dc189b5418..fc3d158fa7 100644 --- a/deps/npm/node_modules/pacote/lib/util/git.js +++ b/deps/npm/node_modules/pacote/lib/util/git.js @@ -105,7 +105,7 @@ function revs (repo, opts) { return BB.resolve(cached) } return pinflight(`ls-remote:${repo}`, () => { - return spawnGit(['ls-remote', repo, '-t', '-h', '*'], { + return spawnGit(['ls-remote', '-h', '-t', repo], { env: gitEnv() }, opts).then(child => { let stdout = '' @@ -117,6 +117,7 @@ function revs (repo, opts) { const sha = split[0].trim() const ref = split[1].trim().match(/(?:refs\/[^/]+\/)?(.*)/)[1] if (!ref) { return revs } // ??? + if (ref.match(/\^\{\}$/)) { return revs } // refs/tags/x^{} crap const type = refType(line) const doc = {sha, ref, type} diff --git a/deps/npm/node_modules/pacote/lib/util/opt-check.js b/deps/npm/node_modules/pacote/lib/util/opt-check.js index dd8aa518dc..a2692836a3 100644 --- a/deps/npm/node_modules/pacote/lib/util/opt-check.js +++ b/deps/npm/node_modules/pacote/lib/util/opt-check.js @@ -12,7 +12,11 @@ function PacoteOptions (opts) { this.scopeTargets = opts.scopeTargets || {} this.defaultTag = opts.defaultTag || 'latest' this.cache = opts.cache + this.ca = opts.ca + this.cert = opts.cert this.integrity = opts.integrity + this.key = opts.key + this.localAddress = opts.localAddress this.log = opts.log || silentlog this.memoize = opts.memoize this.maxSockets = opts.maxSockets || 10 @@ -26,6 +30,7 @@ function PacoteOptions (opts) { this.userAgent = opts.userAgent || `${pkg.name}@${pkg.version}/node@${process.version}+${process.arch} (${process.platform})` this.where = opts.where this.preferOnline = opts.preferOnline + this.strictSSL = !!opts.strictSSL this.isFromCI = !!( opts.isFromCI || process.env['CI'] === 'true' || @@ -33,6 +38,7 @@ function PacoteOptions (opts) { process.env['JENKINS_URL'] || process.env['bamboo.buildKey'] ) + this.npmSession = opts.npmSession this.refer = opts.referer || opts.refer this.projectScope = opts.projectScope this.fullMetadata = opts.fullMetadata diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/CHANGELOG.md b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/CHANGELOG.md index 854388027b..54d88f3391 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/CHANGELOG.md +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/CHANGELOG.md @@ -2,6 +2,27 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +<a name="2.4.11"></a> +## [2.4.11](https://github.com/zkat/make-fetch-happen/compare/v2.4.10...v2.4.11) (2017-06-05) + + +### Bug Fixes + +* **deps:** bump deps with ssri fix ([bef1994](https://github.com/zkat/make-fetch-happen/commit/bef1994)) + + + +<a name="2.4.10"></a> +## [2.4.10](https://github.com/zkat/make-fetch-happen/compare/v2.4.9...v2.4.10) (2017-05-31) + + +### Bug Fixes + +* **deps:** bump dep versions with bugfixes ([0af4003](https://github.com/zkat/make-fetch-happen/commit/0af4003)) +* **proxy:** use auth parameter for proxy authentication (#30) ([c687306](https://github.com/zkat/make-fetch-happen/commit/c687306)) + + + <a name="2.4.9"></a> ## [2.4.9](https://github.com/zkat/make-fetch-happen/compare/v2.4.8...v2.4.9) (2017-05-25) diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/agent.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/agent.js index 0100498947..a3c910eb93 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/agent.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/agent.js @@ -126,6 +126,7 @@ function getProxy (proxyUrl, opts, isHttps) { port: proxyUrl.port, protocol: proxyUrl.protocol, path: proxyUrl.path, + auth: proxyUrl.auth, ca: opts.ca, cert: opts.cert, key: opts.key, diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/.travis.yml b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/.travis.yml index 85a50123c6..20b794051c 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/.travis.yml +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/.travis.yml @@ -1,8 +1,29 @@ +sudo: false + language: node_js + node_js: - "0.8" - "0.10" - "0.12" -before_install: - - '[ "${TRAVIS_NODE_VERSION}" != "0.8" ] || npm install -g npm@1.4.28' - - npm install -g npm@latest + - "1" + - "2" + - "3" + - "4" + - "5" + - "6" + - "7" + +install: + - PATH="`npm bin`:`npm bin -g`:$PATH" + # Node 0.8 comes with a too obsolete npm + - if [[ "`node --version`" =~ ^v0\.8\. ]]; then npm install -g npm@1.4.28 ; fi + # Install dependencies and build + - npm install + +script: + # Output useful info for debugging + - node --version + - npm --version + # Run tests + - npm test diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/History.md b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/History.md index 0ceef6c13f..2191a9e801 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/History.md +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/History.md @@ -1,4 +1,22 @@ +2.1.1 / 2017-05-30 +================== + + * Revert [fe2162e0ba18123f5b301cba4de1e9dd74e437cd](https://github.com/TooTallNate/node-agent-base/commit/fe2162e0ba18123f5b301cba4de1e9dd74e437cd) and [270bdc92eb8e3bd0444d1e5266e8e9390aeb3095](https://github.com/TooTallNate/node-agent-base/commit/270bdc92eb8e3bd0444d1e5266e8e9390aeb3095) (fixes #7) + +2.1.0 / 2017-05-26 +================== + + * unref is not supported for node < 0.9.1 (@pi0) + * add tests to dangling socket (@pi0) + * check unref() is supported (@pi0) + * fix dangling sockets problem (@pi0) + * add basic "ws" module tests + * make `Agent` be subclassable + * turn `addRequest()` into a named function + * test: Node.js v4 likes to call `cork` on the stream (#3, @tomhughes) + * travis: test node v4, v5, v6 and v7 + 2.0.1 / 2015-09-10 ================== diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/agent.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/agent.js index 4005ebc0ef..7ea91f886c 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/agent.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/agent.js @@ -24,12 +24,17 @@ module.exports = Agent; function Agent (callback) { if (!(this instanceof Agent)) return new Agent(callback); - if ('function' != typeof callback) throw new Error('Must pass a "callback function"'); EventEmitter.call(this); - this.callback = callback; + if ('function' === typeof callback) { + this.callback = callback; + } } inherits(Agent, EventEmitter); +Agent.prototype.callback = function callback (req, opts, fn) { + fn(new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')); +}; + /** * Called by node-core's "_http_client.js" module when creating * a new HTTP request with this Agent instance. @@ -37,7 +42,7 @@ inherits(Agent, EventEmitter); * @api public */ -Agent.prototype.addRequest = function (req, host, port, localAddress) { +Agent.prototype.addRequest = function addRequest (req, host, port, localAddress) { var opts; if ('object' == typeof host) { // >= v0.11.x API diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/package.json b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/package.json index 0e296ced06..f74df4fcb7 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/package.json +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/package.json @@ -1,7 +1,8 @@ { "_from": "agent-base@2", - "_id": "agent-base@2.0.1", - "_integrity": "sha1-vY+ehqjrIh//oHvRS+/VXfFCgV4=", + "_id": "agent-base@2.1.1", + "_inBundle": false, + "_integrity": "sha1-1t4Q1a9hMtW9aSQn1G/FOFOQlMc=", "_location": "/pacote/make-fetch-happen/http-proxy-agent/agent-base", "_phantomChildren": {}, "_requested": { @@ -17,9 +18,8 @@ "_requiredBy": [ "/pacote/make-fetch-happen/http-proxy-agent" ], - "_resolved": "https://registry.npmjs.org/agent-base/-/agent-base-2.0.1.tgz", - "_shasum": "bd8f9e86a8eb221fffa07bd14befd55df142815e", - "_shrinkwrap": null, + "_resolved": "https://registry.npmjs.org/agent-base/-/agent-base-2.1.1.tgz", + "_shasum": "d6de10d5af6132d5bd692427d46fc538539094c7", "_spec": "agent-base@2", "_where": "/Users/zkat/Documents/code/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent", "author": { @@ -27,7 +27,6 @@ "email": "nathan@tootallnate.net", "url": "http://n8.io/" }, - "bin": null, "bugs": { "url": "https://github.com/TooTallNate/node-agent-base/issues" }, @@ -39,7 +38,8 @@ "deprecated": false, "description": "Turn a function into an `http.Agent` instance", "devDependencies": { - "mocha": "2" + "mocha": "2", + "ws": "0.8.0" }, "homepage": "https://github.com/TooTallNate/node-agent-base#readme", "keywords": [ @@ -52,8 +52,6 @@ "license": "MIT", "main": "agent.js", "name": "agent-base", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git://github.com/TooTallNate/node-agent-base.git" @@ -61,5 +59,5 @@ "scripts": { "test": "mocha --reporter spec" }, - "version": "2.0.1" + "version": "2.1.1" } diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/test/test.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/test/test.js index f87d308f8e..7d8dee66ce 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/test/test.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/test/test.js @@ -9,13 +9,45 @@ var net = require('net'); var tls = require('tls'); var http = require('http'); var https = require('https'); +var WebSocket = require('ws'); var assert = require('assert'); var events = require('events'); +var inherits = require('util').inherits; +var semver = require('semver'); var Agent = require('../'); describe('Agent', function () { + describe('subclass', function () { + it('should be subclassable', function (done) { + function MyAgent () { + Agent.call(this); + } + inherits(MyAgent, Agent); + + MyAgent.prototype.callback = function (req, opts, fn) { + assert.equal(req.path, '/foo'); + assert.equal(req.getHeader('host'), '127.0.0.1:1234'); + assert.equal(opts.secureEndpoint, true); + done(); + }; + + var info = url.parse('https://127.0.0.1:1234/foo'); + info.agent = new MyAgent; + https.get(info); + }); + }); describe('"error" event', function () { - it('should be invoked on `http.ClientRequest` instance if passed to callback function on the first tick', function (done) { + it('should be invoked on `http.ClientRequest` instance if `callback()` has not been defined', function (done) { + var agent = new Agent(); + var info = url.parse('http://127.0.0.1/foo'); + info.agent = agent; + var req = http.get(info); + req.on('error', function (err) { + assert.equal('"agent-base" has no default implementation, you must subclass and override `callback()`', err.message); + done(); + }); + }); + it('should be invoked on `http.ClientRequest` instance if Error passed to callback function on the first tick', function (done) { var agent = new Agent(function (req, opts, fn) { fn(new Error('is this caught?')); }); @@ -27,7 +59,7 @@ describe('Agent', function () { done(); }); }); - it('should be invoked on `http.ClientRequest` instance if passed to callback function after the first tick', function (done) { + it('should be invoked on `http.ClientRequest` instance if Error passed to callback function after the first tick', function (done) { var agent = new Agent(function (req, opts, fn) { setTimeout(function () { fn(new Error('is this caught?')); @@ -54,6 +86,10 @@ describe('Agent', function () { done(); }; + // needed for `http` module in Node.js 4 + stream.cork = function () { + }; + var opts = { method: 'GET', host: '127.0.0.1', @@ -298,3 +334,118 @@ describe('"https" module', function () { }); }); }); + +describe('"ws" server', function () { + var wss; + var server; + var port; + + // setup test HTTP server + before(function (done) { + server = http.createServer() + wss = new WebSocket.Server({ server: server }); + server.listen(0, function () { + port = server.address().port; + done(); + }); + }); + + // shut down test HTTP server + after(function (done) { + server.once('close', function () { + done(); + }); + server.close(); + }); + + it('should work for basic WebSocket connections', function (done) { + function onconnection(ws) { + ws.on('message', function (data) { + assert.equal('ping', data); + ws.send('pong'); + }); + } + wss.on('connection', onconnection); + + var agent = new Agent(function (req, opts, fn) { + var socket = net.connect(opts); + fn(null, socket); + }); + + var client = new WebSocket('ws://127.0.0.1:' + port + '/', { + agent: agent + }); + + client.on('open', function () { + client.send('ping'); + }); + + client.on('message', function (data) { + assert.equal('pong', data); + client.close(); + wss.removeListener('connection', onconnection); + done(); + }); + }); + +}); + +describe('"wss" server', function () { + var wss; + var server; + var port; + + // setup test HTTP server + before(function (done) { + var options = { + key: fs.readFileSync(__dirname + '/ssl-cert-snakeoil.key'), + cert: fs.readFileSync(__dirname + '/ssl-cert-snakeoil.pem') + }; + server = https.createServer(options); + wss = new WebSocket.Server({ server: server }); + server.listen(0, function () { + port = server.address().port; + done(); + }); + }); + + // shut down test HTTP server + after(function (done) { + server.once('close', function () { + done(); + }); + server.close(); + }); + + it('should work for secure WebSocket connections', function (done) { + function onconnection(ws) { + ws.on('message', function (data) { + assert.equal('ping', data); + ws.send('pong'); + }); + } + wss.on('connection', onconnection); + + var agent = new Agent(function (req, opts, fn) { + var socket = tls.connect(opts); + fn(null, socket); + }); + + var client = new WebSocket('wss://127.0.0.1:' + port + '/', { + agent: agent, + rejectUnauthorized: false + }); + + client.on('open', function () { + client.send('ping'); + }); + + client.on('message', function (data) { + assert.equal('pong', data); + client.close(); + wss.removeListener('connection', onconnection); + done(); + }); + }); + +}); diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/.travis.yml b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/.travis.yml index 85a50123c6..20b794051c 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/.travis.yml +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/.travis.yml @@ -1,8 +1,29 @@ +sudo: false + language: node_js + node_js: - "0.8" - "0.10" - "0.12" -before_install: - - '[ "${TRAVIS_NODE_VERSION}" != "0.8" ] || npm install -g npm@1.4.28' - - npm install -g npm@latest + - "1" + - "2" + - "3" + - "4" + - "5" + - "6" + - "7" + +install: + - PATH="`npm bin`:`npm bin -g`:$PATH" + # Node 0.8 comes with a too obsolete npm + - if [[ "`node --version`" =~ ^v0\.8\. ]]; then npm install -g npm@1.4.28 ; fi + # Install dependencies and build + - npm install + +script: + # Output useful info for debugging + - node --version + - npm --version + # Run tests + - npm test diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/History.md b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/History.md index 0ceef6c13f..2191a9e801 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/History.md +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/History.md @@ -1,4 +1,22 @@ +2.1.1 / 2017-05-30 +================== + + * Revert [fe2162e0ba18123f5b301cba4de1e9dd74e437cd](https://github.com/TooTallNate/node-agent-base/commit/fe2162e0ba18123f5b301cba4de1e9dd74e437cd) and [270bdc92eb8e3bd0444d1e5266e8e9390aeb3095](https://github.com/TooTallNate/node-agent-base/commit/270bdc92eb8e3bd0444d1e5266e8e9390aeb3095) (fixes #7) + +2.1.0 / 2017-05-26 +================== + + * unref is not supported for node < 0.9.1 (@pi0) + * add tests to dangling socket (@pi0) + * check unref() is supported (@pi0) + * fix dangling sockets problem (@pi0) + * add basic "ws" module tests + * make `Agent` be subclassable + * turn `addRequest()` into a named function + * test: Node.js v4 likes to call `cork` on the stream (#3, @tomhughes) + * travis: test node v4, v5, v6 and v7 + 2.0.1 / 2015-09-10 ================== diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/agent.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/agent.js index 4005ebc0ef..7ea91f886c 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/agent.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/agent.js @@ -24,12 +24,17 @@ module.exports = Agent; function Agent (callback) { if (!(this instanceof Agent)) return new Agent(callback); - if ('function' != typeof callback) throw new Error('Must pass a "callback function"'); EventEmitter.call(this); - this.callback = callback; + if ('function' === typeof callback) { + this.callback = callback; + } } inherits(Agent, EventEmitter); +Agent.prototype.callback = function callback (req, opts, fn) { + fn(new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')); +}; + /** * Called by node-core's "_http_client.js" module when creating * a new HTTP request with this Agent instance. @@ -37,7 +42,7 @@ inherits(Agent, EventEmitter); * @api public */ -Agent.prototype.addRequest = function (req, host, port, localAddress) { +Agent.prototype.addRequest = function addRequest (req, host, port, localAddress) { var opts; if ('object' == typeof host) { // >= v0.11.x API diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/package.json b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/package.json index b57e81b1b4..9dedd7231d 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/package.json +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/package.json @@ -1,7 +1,8 @@ { "_from": "agent-base@2", - "_id": "agent-base@2.0.1", - "_integrity": "sha1-vY+ehqjrIh//oHvRS+/VXfFCgV4=", + "_id": "agent-base@2.1.1", + "_inBundle": false, + "_integrity": "sha1-1t4Q1a9hMtW9aSQn1G/FOFOQlMc=", "_location": "/pacote/make-fetch-happen/https-proxy-agent/agent-base", "_phantomChildren": {}, "_requested": { @@ -17,9 +18,8 @@ "_requiredBy": [ "/pacote/make-fetch-happen/https-proxy-agent" ], - "_resolved": "https://registry.npmjs.org/agent-base/-/agent-base-2.0.1.tgz", - "_shasum": "bd8f9e86a8eb221fffa07bd14befd55df142815e", - "_shrinkwrap": null, + "_resolved": "https://registry.npmjs.org/agent-base/-/agent-base-2.1.1.tgz", + "_shasum": "d6de10d5af6132d5bd692427d46fc538539094c7", "_spec": "agent-base@2", "_where": "/Users/zkat/Documents/code/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent", "author": { @@ -27,7 +27,6 @@ "email": "nathan@tootallnate.net", "url": "http://n8.io/" }, - "bin": null, "bugs": { "url": "https://github.com/TooTallNate/node-agent-base/issues" }, @@ -39,7 +38,8 @@ "deprecated": false, "description": "Turn a function into an `http.Agent` instance", "devDependencies": { - "mocha": "2" + "mocha": "2", + "ws": "0.8.0" }, "homepage": "https://github.com/TooTallNate/node-agent-base#readme", "keywords": [ @@ -52,8 +52,6 @@ "license": "MIT", "main": "agent.js", "name": "agent-base", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git://github.com/TooTallNate/node-agent-base.git" @@ -61,5 +59,5 @@ "scripts": { "test": "mocha --reporter spec" }, - "version": "2.0.1" + "version": "2.1.1" } diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/test/test.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/test/test.js index f87d308f8e..7d8dee66ce 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/test/test.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/test/test.js @@ -9,13 +9,45 @@ var net = require('net'); var tls = require('tls'); var http = require('http'); var https = require('https'); +var WebSocket = require('ws'); var assert = require('assert'); var events = require('events'); +var inherits = require('util').inherits; +var semver = require('semver'); var Agent = require('../'); describe('Agent', function () { + describe('subclass', function () { + it('should be subclassable', function (done) { + function MyAgent () { + Agent.call(this); + } + inherits(MyAgent, Agent); + + MyAgent.prototype.callback = function (req, opts, fn) { + assert.equal(req.path, '/foo'); + assert.equal(req.getHeader('host'), '127.0.0.1:1234'); + assert.equal(opts.secureEndpoint, true); + done(); + }; + + var info = url.parse('https://127.0.0.1:1234/foo'); + info.agent = new MyAgent; + https.get(info); + }); + }); describe('"error" event', function () { - it('should be invoked on `http.ClientRequest` instance if passed to callback function on the first tick', function (done) { + it('should be invoked on `http.ClientRequest` instance if `callback()` has not been defined', function (done) { + var agent = new Agent(); + var info = url.parse('http://127.0.0.1/foo'); + info.agent = agent; + var req = http.get(info); + req.on('error', function (err) { + assert.equal('"agent-base" has no default implementation, you must subclass and override `callback()`', err.message); + done(); + }); + }); + it('should be invoked on `http.ClientRequest` instance if Error passed to callback function on the first tick', function (done) { var agent = new Agent(function (req, opts, fn) { fn(new Error('is this caught?')); }); @@ -27,7 +59,7 @@ describe('Agent', function () { done(); }); }); - it('should be invoked on `http.ClientRequest` instance if passed to callback function after the first tick', function (done) { + it('should be invoked on `http.ClientRequest` instance if Error passed to callback function after the first tick', function (done) { var agent = new Agent(function (req, opts, fn) { setTimeout(function () { fn(new Error('is this caught?')); @@ -54,6 +86,10 @@ describe('Agent', function () { done(); }; + // needed for `http` module in Node.js 4 + stream.cork = function () { + }; + var opts = { method: 'GET', host: '127.0.0.1', @@ -298,3 +334,118 @@ describe('"https" module', function () { }); }); }); + +describe('"ws" server', function () { + var wss; + var server; + var port; + + // setup test HTTP server + before(function (done) { + server = http.createServer() + wss = new WebSocket.Server({ server: server }); + server.listen(0, function () { + port = server.address().port; + done(); + }); + }); + + // shut down test HTTP server + after(function (done) { + server.once('close', function () { + done(); + }); + server.close(); + }); + + it('should work for basic WebSocket connections', function (done) { + function onconnection(ws) { + ws.on('message', function (data) { + assert.equal('ping', data); + ws.send('pong'); + }); + } + wss.on('connection', onconnection); + + var agent = new Agent(function (req, opts, fn) { + var socket = net.connect(opts); + fn(null, socket); + }); + + var client = new WebSocket('ws://127.0.0.1:' + port + '/', { + agent: agent + }); + + client.on('open', function () { + client.send('ping'); + }); + + client.on('message', function (data) { + assert.equal('pong', data); + client.close(); + wss.removeListener('connection', onconnection); + done(); + }); + }); + +}); + +describe('"wss" server', function () { + var wss; + var server; + var port; + + // setup test HTTP server + before(function (done) { + var options = { + key: fs.readFileSync(__dirname + '/ssl-cert-snakeoil.key'), + cert: fs.readFileSync(__dirname + '/ssl-cert-snakeoil.pem') + }; + server = https.createServer(options); + wss = new WebSocket.Server({ server: server }); + server.listen(0, function () { + port = server.address().port; + done(); + }); + }); + + // shut down test HTTP server + after(function (done) { + server.once('close', function () { + done(); + }); + server.close(); + }); + + it('should work for secure WebSocket connections', function (done) { + function onconnection(ws) { + ws.on('message', function (data) { + assert.equal('ping', data); + ws.send('pong'); + }); + } + wss.on('connection', onconnection); + + var agent = new Agent(function (req, opts, fn) { + var socket = tls.connect(opts); + fn(null, socket); + }); + + var client = new WebSocket('wss://127.0.0.1:' + port + '/', { + agent: agent, + rejectUnauthorized: false + }); + + client.on('open', function () { + client.send('ping'); + }); + + client.on('message', function (data) { + assert.equal('pong', data); + client.close(); + wss.removeListener('connection', onconnection); + done(); + }); + }); + +}); diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/.travis.yml b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/.travis.yml index 85a50123c6..20b794051c 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/.travis.yml +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/.travis.yml @@ -1,8 +1,29 @@ +sudo: false + language: node_js + node_js: - "0.8" - "0.10" - "0.12" -before_install: - - '[ "${TRAVIS_NODE_VERSION}" != "0.8" ] || npm install -g npm@1.4.28' - - npm install -g npm@latest + - "1" + - "2" + - "3" + - "4" + - "5" + - "6" + - "7" + +install: + - PATH="`npm bin`:`npm bin -g`:$PATH" + # Node 0.8 comes with a too obsolete npm + - if [[ "`node --version`" =~ ^v0\.8\. ]]; then npm install -g npm@1.4.28 ; fi + # Install dependencies and build + - npm install + +script: + # Output useful info for debugging + - node --version + - npm --version + # Run tests + - npm test diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/History.md b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/History.md index 0ceef6c13f..2191a9e801 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/History.md +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/History.md @@ -1,4 +1,22 @@ +2.1.1 / 2017-05-30 +================== + + * Revert [fe2162e0ba18123f5b301cba4de1e9dd74e437cd](https://github.com/TooTallNate/node-agent-base/commit/fe2162e0ba18123f5b301cba4de1e9dd74e437cd) and [270bdc92eb8e3bd0444d1e5266e8e9390aeb3095](https://github.com/TooTallNate/node-agent-base/commit/270bdc92eb8e3bd0444d1e5266e8e9390aeb3095) (fixes #7) + +2.1.0 / 2017-05-26 +================== + + * unref is not supported for node < 0.9.1 (@pi0) + * add tests to dangling socket (@pi0) + * check unref() is supported (@pi0) + * fix dangling sockets problem (@pi0) + * add basic "ws" module tests + * make `Agent` be subclassable + * turn `addRequest()` into a named function + * test: Node.js v4 likes to call `cork` on the stream (#3, @tomhughes) + * travis: test node v4, v5, v6 and v7 + 2.0.1 / 2015-09-10 ================== diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/agent.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/agent.js index 4005ebc0ef..7ea91f886c 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/agent.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/agent.js @@ -24,12 +24,17 @@ module.exports = Agent; function Agent (callback) { if (!(this instanceof Agent)) return new Agent(callback); - if ('function' != typeof callback) throw new Error('Must pass a "callback function"'); EventEmitter.call(this); - this.callback = callback; + if ('function' === typeof callback) { + this.callback = callback; + } } inherits(Agent, EventEmitter); +Agent.prototype.callback = function callback (req, opts, fn) { + fn(new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')); +}; + /** * Called by node-core's "_http_client.js" module when creating * a new HTTP request with this Agent instance. @@ -37,7 +42,7 @@ inherits(Agent, EventEmitter); * @api public */ -Agent.prototype.addRequest = function (req, host, port, localAddress) { +Agent.prototype.addRequest = function addRequest (req, host, port, localAddress) { var opts; if ('object' == typeof host) { // >= v0.11.x API diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/package.json b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/package.json index 81950940bb..e204131537 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/package.json +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/package.json @@ -1,7 +1,8 @@ { "_from": "agent-base@2", - "_id": "agent-base@2.0.1", - "_integrity": "sha1-vY+ehqjrIh//oHvRS+/VXfFCgV4=", + "_id": "agent-base@2.1.1", + "_inBundle": false, + "_integrity": "sha1-1t4Q1a9hMtW9aSQn1G/FOFOQlMc=", "_location": "/pacote/make-fetch-happen/socks-proxy-agent/agent-base", "_phantomChildren": {}, "_requested": { @@ -17,9 +18,8 @@ "_requiredBy": [ "/pacote/make-fetch-happen/socks-proxy-agent" ], - "_resolved": "https://registry.npmjs.org/agent-base/-/agent-base-2.0.1.tgz", - "_shasum": "bd8f9e86a8eb221fffa07bd14befd55df142815e", - "_shrinkwrap": null, + "_resolved": "https://registry.npmjs.org/agent-base/-/agent-base-2.1.1.tgz", + "_shasum": "d6de10d5af6132d5bd692427d46fc538539094c7", "_spec": "agent-base@2", "_where": "/Users/zkat/Documents/code/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent", "author": { @@ -27,7 +27,6 @@ "email": "nathan@tootallnate.net", "url": "http://n8.io/" }, - "bin": null, "bugs": { "url": "https://github.com/TooTallNate/node-agent-base/issues" }, @@ -39,7 +38,8 @@ "deprecated": false, "description": "Turn a function into an `http.Agent` instance", "devDependencies": { - "mocha": "2" + "mocha": "2", + "ws": "0.8.0" }, "homepage": "https://github.com/TooTallNate/node-agent-base#readme", "keywords": [ @@ -52,8 +52,6 @@ "license": "MIT", "main": "agent.js", "name": "agent-base", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git://github.com/TooTallNate/node-agent-base.git" @@ -61,5 +59,5 @@ "scripts": { "test": "mocha --reporter spec" }, - "version": "2.0.1" + "version": "2.1.1" } diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/test/test.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/test/test.js index f87d308f8e..7d8dee66ce 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/test/test.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/test/test.js @@ -9,13 +9,45 @@ var net = require('net'); var tls = require('tls'); var http = require('http'); var https = require('https'); +var WebSocket = require('ws'); var assert = require('assert'); var events = require('events'); +var inherits = require('util').inherits; +var semver = require('semver'); var Agent = require('../'); describe('Agent', function () { + describe('subclass', function () { + it('should be subclassable', function (done) { + function MyAgent () { + Agent.call(this); + } + inherits(MyAgent, Agent); + + MyAgent.prototype.callback = function (req, opts, fn) { + assert.equal(req.path, '/foo'); + assert.equal(req.getHeader('host'), '127.0.0.1:1234'); + assert.equal(opts.secureEndpoint, true); + done(); + }; + + var info = url.parse('https://127.0.0.1:1234/foo'); + info.agent = new MyAgent; + https.get(info); + }); + }); describe('"error" event', function () { - it('should be invoked on `http.ClientRequest` instance if passed to callback function on the first tick', function (done) { + it('should be invoked on `http.ClientRequest` instance if `callback()` has not been defined', function (done) { + var agent = new Agent(); + var info = url.parse('http://127.0.0.1/foo'); + info.agent = agent; + var req = http.get(info); + req.on('error', function (err) { + assert.equal('"agent-base" has no default implementation, you must subclass and override `callback()`', err.message); + done(); + }); + }); + it('should be invoked on `http.ClientRequest` instance if Error passed to callback function on the first tick', function (done) { var agent = new Agent(function (req, opts, fn) { fn(new Error('is this caught?')); }); @@ -27,7 +59,7 @@ describe('Agent', function () { done(); }); }); - it('should be invoked on `http.ClientRequest` instance if passed to callback function after the first tick', function (done) { + it('should be invoked on `http.ClientRequest` instance if Error passed to callback function after the first tick', function (done) { var agent = new Agent(function (req, opts, fn) { setTimeout(function () { fn(new Error('is this caught?')); @@ -54,6 +86,10 @@ describe('Agent', function () { done(); }; + // needed for `http` module in Node.js 4 + stream.cork = function () { + }; + var opts = { method: 'GET', host: '127.0.0.1', @@ -298,3 +334,118 @@ describe('"https" module', function () { }); }); }); + +describe('"ws" server', function () { + var wss; + var server; + var port; + + // setup test HTTP server + before(function (done) { + server = http.createServer() + wss = new WebSocket.Server({ server: server }); + server.listen(0, function () { + port = server.address().port; + done(); + }); + }); + + // shut down test HTTP server + after(function (done) { + server.once('close', function () { + done(); + }); + server.close(); + }); + + it('should work for basic WebSocket connections', function (done) { + function onconnection(ws) { + ws.on('message', function (data) { + assert.equal('ping', data); + ws.send('pong'); + }); + } + wss.on('connection', onconnection); + + var agent = new Agent(function (req, opts, fn) { + var socket = net.connect(opts); + fn(null, socket); + }); + + var client = new WebSocket('ws://127.0.0.1:' + port + '/', { + agent: agent + }); + + client.on('open', function () { + client.send('ping'); + }); + + client.on('message', function (data) { + assert.equal('pong', data); + client.close(); + wss.removeListener('connection', onconnection); + done(); + }); + }); + +}); + +describe('"wss" server', function () { + var wss; + var server; + var port; + + // setup test HTTP server + before(function (done) { + var options = { + key: fs.readFileSync(__dirname + '/ssl-cert-snakeoil.key'), + cert: fs.readFileSync(__dirname + '/ssl-cert-snakeoil.pem') + }; + server = https.createServer(options); + wss = new WebSocket.Server({ server: server }); + server.listen(0, function () { + port = server.address().port; + done(); + }); + }); + + // shut down test HTTP server + after(function (done) { + server.once('close', function () { + done(); + }); + server.close(); + }); + + it('should work for secure WebSocket connections', function (done) { + function onconnection(ws) { + ws.on('message', function (data) { + assert.equal('ping', data); + ws.send('pong'); + }); + } + wss.on('connection', onconnection); + + var agent = new Agent(function (req, opts, fn) { + var socket = tls.connect(opts); + fn(null, socket); + }); + + var client = new WebSocket('wss://127.0.0.1:' + port + '/', { + agent: agent, + rejectUnauthorized: false + }); + + client.on('open', function () { + client.send('ping'); + }); + + client.on('message', function (data) { + assert.equal('pong', data); + client.close(); + wss.removeListener('connection', onconnection); + done(); + }); + }); + +}); diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/package.json b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/package.json index 8b8e2cd878..3760722354 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/package.json +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/package.json @@ -1,28 +1,28 @@ { - "_from": "make-fetch-happen@^2.4.9", - "_id": "make-fetch-happen@2.4.9", + "_from": "make-fetch-happen@^2.4.11", + "_id": "make-fetch-happen@2.4.11", "_inBundle": false, - "_integrity": "sha512-/qh6T1E2gBD31bhutxeFehcHDwbBJJ7F+7w8bNAzPbacqfTwEpeo7W5SVQqciCSfNex51SjnEyw1XuK4zDn+Fw==", + "_integrity": "sha512-3dbl9CVS9Y0hqVzcD5HBYnaNUGw3XWpmeTqGT6ACRrmKS7WKwSDfv5+Gd1K0X/Mt52hsvZwtOH8hrNIulYkhag==", "_location": "/pacote/make-fetch-happen", "_phantomChildren": { - "safe-buffer": "5.0.1" + "safe-buffer": "5.1.0" }, "_requested": { "type": "range", "registry": true, - "raw": "make-fetch-happen@^2.4.9", + "raw": "make-fetch-happen@^2.4.11", "name": "make-fetch-happen", "escapedName": "make-fetch-happen", - "rawSpec": "^2.4.9", + "rawSpec": "^2.4.11", "saveSpec": null, - "fetchSpec": "^2.4.9" + "fetchSpec": "^2.4.11" }, "_requiredBy": [ "/pacote" ], - "_resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-2.4.9.tgz", - "_shasum": "245b799e35da3ec05a45e6ef31f9c34df7d1e0c1", - "_spec": "make-fetch-happen@^2.4.9", + "_resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-2.4.11.tgz", + "_shasum": "0b29967da2dc995e88f778dd0c673855ec7613e3", + "_spec": "make-fetch-happen@^2.4.11", "_where": "/Users/zkat/Documents/code/npm/node_modules/pacote", "author": { "name": "Kat Marchán", @@ -34,7 +34,7 @@ "bundleDependencies": false, "dependencies": { "agentkeepalive": "^3.1.0", - "cacache": "^9.2.4", + "cacache": "^9.2.7", "http-cache-semantics": "^3.7.3", "http-proxy-agent": "^1.0.0", "https-proxy-agent": "^1.0.0", @@ -42,8 +42,8 @@ "mississippi": "^1.2.0", "node-fetch-npm": "^2.0.1", "promise-retry": "^1.1.1", - "socks-proxy-agent": "^2.0.0", - "ssri": "^4.1.3" + "socks-proxy-agent": "^2.1.0", + "ssri": "^4.1.5" }, "deprecated": false, "description": "Opinionated, caching, retrying fetch client", @@ -52,13 +52,13 @@ "mkdirp": "^0.5.1", "nock": "^9.0.6", "npmlog": "^4.1.0", - "nyc": "^10.3.2", + "nyc": "^11.0.2", "rimraf": "^2.5.4", - "safe-buffer": "^5.0.1", + "safe-buffer": "^5.1.0", "standard": "^10.0.1", "standard-version": "^4.0.0", "tacks": "^1.2.6", - "tap": "^10.2.0", + "tap": "^10.3.3", "weallbehave": "^1.0.0", "weallcontribute": "^1.0.7" }, @@ -92,5 +92,5 @@ "update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'", "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'" }, - "version": "2.4.9" + "version": "2.4.11" } diff --git a/deps/npm/node_modules/pacote/package.json b/deps/npm/node_modules/pacote/package.json index c27683d0d2..44e5b7eca0 100644 --- a/deps/npm/node_modules/pacote/package.json +++ b/deps/npm/node_modules/pacote/package.json @@ -1,40 +1,40 @@ { - "_from": "pacote@2.7.21", - "_id": "pacote@2.7.21", + "_from": "pacote@2.7.30", + "_id": "pacote@2.7.30", "_inBundle": false, - "_integrity": "sha512-ksTHJiAkJxLmcOGxO6iGMk1cVMTTtIC051ZUqvWbckICIhzScOSBgGRBc4CHRhd62NuqAL082RuOOmb1Mi6o6Q==", + "_integrity": "sha512-xFxozbxytemyfNPZmkL2seTD15mozK8ghov9npjBO4YTs3SnA8I55aiN94eZJ+XhLKzbN8yXqQMr9ti4c3WIDw==", "_location": "/pacote", "_phantomChildren": { - "cacache": "9.2.5", + "cacache": "9.2.8", "chownr": "1.0.1", "lru-cache": "4.0.2", "mississippi": "1.3.0", "mkdirp": "0.5.1", - "npm-package-arg": "5.0.1", + "npm-package-arg": "5.1.1", "once": "1.4.0", - "readable-stream": "2.2.9", + "readable-stream": "2.2.10", "retry": "0.10.1", - "safe-buffer": "5.0.1", + "safe-buffer": "5.1.0", "semver": "5.3.0", - "ssri": "4.1.3" + "ssri": "4.1.5" }, "_requested": { "type": "version", "registry": true, - "raw": "pacote@2.7.21", + "raw": "pacote@2.7.30", "name": "pacote", "escapedName": "pacote", - "rawSpec": "2.7.21", + "rawSpec": "2.7.30", "saveSpec": null, - "fetchSpec": "2.7.21" + "fetchSpec": "2.7.30" }, "_requiredBy": [ "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/pacote/-/pacote-2.7.21.tgz", - "_shasum": "e909e8a0559940053300e1127297e92a1302d244", - "_spec": "pacote@2.7.21", + "_resolved": "https://registry.npmjs.org/pacote/-/pacote-2.7.30.tgz", + "_shasum": "f31678e0a40161b592498688c1e2c8d7918eac7e", + "_spec": "pacote@2.7.30", "_where": "/Users/zkat/Documents/code/npm", "author": { "name": "Kat Marchán", @@ -56,22 +56,22 @@ ], "dependencies": { "bluebird": "^3.5.0", - "cacache": "^9.2.5", + "cacache": "^9.2.8", "glob": "^7.1.2", "lru-cache": "^4.0.2", - "make-fetch-happen": "^2.4.9", + "make-fetch-happen": "^2.4.11", "minimatch": "^3.0.4", "mississippi": "^1.2.0", "normalize-package-data": "^2.3.6", - "npm-package-arg": "^5.0.0", + "npm-package-arg": "^5.1.1", "npm-pick-manifest": "^1.0.3", "osenv": "^0.1.4", "promise-inflight": "^1.0.1", "promise-retry": "^1.1.1", "protoduck": "^4.0.0", - "safe-buffer": "^5.0.1", + "safe-buffer": "^5.1.0", "semver": "^5.3.0", - "ssri": "^4.1.3", + "ssri": "^4.1.5", "tar-fs": "^1.15.1", "tar-stream": "^1.5.4", "unique-filename": "^1.1.0", @@ -83,13 +83,13 @@ "mkdirp": "^0.5.1", "nock": "^9.0.13", "npmlog": "^4.1.0", - "nyc": "^10.3.2", + "nyc": "^11.0.2", "require-inject": "^1.4.0", "rimraf": "^2.5.4", "standard": "^10.0.1", "standard-version": "^4.0.0", "tacks": "^1.2.6", - "tap": "^10.2.0", + "tap": "^10.3.3", "weallbehave": "^1.2.0", "weallcontribute": "^1.0.7" }, @@ -120,5 +120,5 @@ "update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'", "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'" }, - "version": "2.7.21" + "version": "2.7.30" } |