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

npm-registry-client

Package Overview
Dependencies
Maintainers
1
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-registry-client - npm Package Compare versions

Comparing version 0.4.4 to 0.4.5

test/request-gzip-content.js

5

lib/adduser.js

@@ -27,4 +27,3 @@ module.exports = adduser

{ name : username
, salt : salt
, password_sha : sha(password + salt)
, password : password
, email : email

@@ -55,3 +54,3 @@ , _id : 'org.couchdb.user:'+username

var logObj = Object.keys(userobj).map(function (k) {
if (k === 'salt' || k === 'password_sha') return [k, 'XXXXX']
if (k === 'password') return [k, 'XXXXX']
return [k, userobj[k]]

@@ -58,0 +57,0 @@ }).reduce(function (s, kv) {

19

lib/request.js
module.exports = regRequest
var url = require("url")
, zlib = require("zlib")
, fs = require("graceful-fs")

@@ -131,2 +132,3 @@ , rm = require("rimraf")

, method: method
, encoding: null // tell request let body be Buffer instance
, ca: this.conf.get('ca')

@@ -144,2 +146,3 @@ , localAddress: this.conf.get('local-address')

headers.accept = "application/json"
headers['accept-encoding'] = 'gzip'

@@ -175,3 +178,3 @@ headers["user-agent"] = this.conf.get('user-agent') ||

var done = requestDone.call(this, method, where, cb)
var req = request(opts, done)
var req = request(opts, decodeResponseBody(done))

@@ -188,2 +191,16 @@ req.on("error", cb)

function decodeResponseBody(cb) {
return function (er, response, data) {
if (er) return cb(er, response, data)
if (response.headers['content-encoding'] !== 'gzip') return cb(er, response, data)
zlib.gunzip(data, function (er, buf) {
if (er) return cb(er, response, data)
cb(null, response, buf)
})
}
}
// cb(er, parsed, raw, response)

@@ -190,0 +207,0 @@ function requestDone (method, where, cb) {

@@ -5,3 +5,3 @@ {

"description": "Client for the npm registry",
"version": "0.4.4",
"version": "0.4.5",
"repository": {

@@ -8,0 +8,0 @@ "url": "git://github.com/isaacs/npm-registry-client"

@@ -35,5 +35,3 @@ var tap = require('tap')

var o = JSON.parse(b)
var salt = o.salt
userdata.salt = salt
userdata.password_sha = sha(password + salt)
userdata.password = password
userdata.date = o.date

@@ -40,0 +38,0 @@ t.deepEqual(o, userdata)

@@ -50,5 +50,3 @@ var tap = require('tap')

var o = JSON.parse(b)
var salt = o.salt
userdata.salt = salt
userdata.password_sha = sha(password + salt)
userdata.password = password
userdata.date = o.date

@@ -55,0 +53,0 @@ t.deepEqual(o, userdata)

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