Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZach Renner <zarenner@microsoft.com>2017-06-05 22:39:56 +0300
committerKat Marchán <kzm@sykosomatic.org>2017-06-05 22:39:56 +0300
commit6a9b51c67ba3df0372991631992748329b84f2e7 (patch)
treeec58012b7c6d0c3dee091f8d802b3871c2e52f0f /lib
parentd654a8e1a73c76b52476760a39e729373fe2c473 (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.js5
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,