diff options
author | Zach Renner <zarenner@microsoft.com> | 2017-06-05 22:39:56 +0300 |
---|---|---|
committer | Kat Marchán <kzm@sykosomatic.org> | 2017-06-05 22:39:56 +0300 |
commit | 6a9b51c67ba3df0372991631992748329b84f2e7 (patch) | |
tree | ec58012b7c6d0c3dee091f8d802b3871c2e52f0f /lib | |
parent | d654a8e1a73c76b52476760a39e729373fe2c473 (diff) |
pacote: Generate and pass npm-session header value to pacote (#16929)
PR-URL: https://github.com/npm/npm/pull/16929
Credit: @zarenner
Reviewed-By: @zkat
Diffstat (limited to 'lib')
-rw-r--r-- | lib/config/pacote.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/config/pacote.js b/lib/config/pacote.js index 705544fe3..9f2d35678 100644 --- a/lib/config/pacote.js +++ b/lib/config/pacote.js @@ -2,6 +2,7 @@ const Buffer = require('safe-buffer').Buffer +const crypto = require("crypto") const npm = require('../npm') const log = require('npmlog') let pack @@ -9,6 +10,9 @@ const path = require('path') let effectiveOwner +const npmSession = crypto.randomBytes(8).toString('hex') +log.verbose('npm-session', npmSession) + module.exports = pacoteOpts function pacoteOpts (moreOpts) { if (!pack) { @@ -24,6 +28,7 @@ function pacoteOpts (moreOpts) { log: log, maxAge: npm.config.get('cache-min'), maxSockets: npm.config.get('maxsockets'), + npmSession: npmSession, offline: npm.config.get('offline'), preferOffline: npm.config.get('prefer-offline') || npm.config.get('cache-min') > 9999, preferOnline: npm.config.get('prefer-online') || npm.config.get('cache-max') <= 0, |