diff --git a/node_modules/request/.travis.yml b/node_modules/request/.travis.yml index c24c59b5d5b..e5d9bde2626 100644 --- a/node_modules/request/.travis.yml +++ b/node_modules/request/.travis.yml @@ -1,15 +1,19 @@ language: node_js + node_js: - node - - io.js - 0.12 - 0.10 -sudo: false -after_script: "npm run test-cov && cat ./coverage/lcov.info | codecov && cat ./coverage/lcov.info | coveralls" +after_script: + - npm run test-cov + - cat ./coverage/lcov.info | codecov + - cat ./coverage/lcov.info | coveralls webhooks: urls: https://webhooks.gitter.im/e/237280ed4796c19cc626 on_success: change # options: [always|never|change] default: always on_failure: always # options: [always|never|change] default: always on_start: false # default: false + +sudo: false diff --git a/node_modules/request/CHANGELOG.md b/node_modules/request/CHANGELOG.md index 34f8e732586..ce6826f2f65 100644 --- a/node_modules/request/CHANGELOG.md +++ b/node_modules/request/CHANGELOG.md @@ -1,5 +1,16 @@ ## Change Log +### v2.72.0 (2016/04/17) +- [#2176](https://github.com/request/request/pull/2176) Do not try to pipe Gzip responses with no body (@simov) +- [#2175](https://github.com/request/request/pull/2175) Add 'delete' alias for the 'del' API method (@simov, @MuhanZou) +- [#2172](https://github.com/request/request/pull/2172) Add support for deflate content encoding (@czardoz) +- [#2169](https://github.com/request/request/pull/2169) Add callback option (@simov) +- [#2165](https://github.com/request/request/pull/2165) Check for self.req existence inside the write method (@simov) +- [#2167](https://github.com/request/request/pull/2167) Fix TravisCI badge reference master branch (@a0viedo) + +### v2.71.0 (2016/04/12) +- [#2164](https://github.com/request/request/pull/2164) Catch errors from the underlying http module (@simov) + ### v2.70.0 (2016/04/05) - [#2147](https://github.com/request/request/pull/2147) Update eslint to version 2.5.3 🚀 (@simov, @greenkeeperio-bot) - [#2009](https://github.com/request/request/pull/2009) Support JSON stringify replacer argument. (@elyobo) diff --git a/node_modules/request/README.md b/node_modules/request/README.md index 64c43e742fa..cf9072a21a2 100644 --- a/node_modules/request/README.md +++ b/node_modules/request/README.md @@ -3,7 +3,7 @@ [![npm package](https://nodei.co/npm/request.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/request/) -[![Build status](https://img.shields.io/travis/request/request.svg?style=flat-square)](https://travis-ci.org/request/request) +[![Build status](https://img.shields.io/travis/request/request/master.svg?style=flat-square)](https://travis-ci.org/request/request) [![Coverage](https://img.shields.io/codecov/c/github/request/request.svg?style=flat-square)](https://codecov.io/github/request/request?branch=master) [![Coverage](https://img.shields.io/coveralls/request/request.svg?style=flat-square)](https://coveralls.io/r/request/request) [![Dependency Status](https://img.shields.io/david/request/request.svg?style=flat-square)](https://david-dm.org/request/request) @@ -814,6 +814,7 @@ default in Linux can be anywhere from 20-120 seconds][linux-timeout]). - `time` - If `true`, the request-response cycle (including all redirects) is timed at millisecond resolution, and the result provided on the response's `elapsedTime` property. - `har` - A [HAR 1.2 Request Object](http://www.softwareishard.com/blog/har-12-spec/#request), will be processed from HAR format into options overwriting matching values *(see the [HAR 1.2 section](#support-for-har-1.2) for details)* +- `callback` - alternatively pass the request's callback in the options object The callback argument gets 3 arguments: @@ -888,12 +889,13 @@ Same as `request()`, but defaults to `method: "HEAD"`. request.head(url) ``` -### request.del +### request.del / request.delete Same as `request()`, but defaults to `method: "DELETE"`. ```js request.del(url) +request.delete(url) ``` ### request.get diff --git a/node_modules/request/index.js b/node_modules/request/index.js index 4d0c748da58..911a90dbb5a 100755 --- a/node_modules/request/index.js +++ b/node_modules/request/index.js @@ -37,7 +37,7 @@ function initParams(uri, options, callback) { extend(params, uri) } - params.callback = callback + params.callback = callback || params.callback return params } @@ -56,7 +56,7 @@ function request (uri, options, callback) { } function verbFunc (verb) { - var method = verb === 'del' ? 'DELETE' : verb.toUpperCase() + var method = verb.toUpperCase() return function (uri, options, callback) { var params = initParams(uri, options, callback) params.method = method @@ -70,7 +70,8 @@ request.head = verbFunc('head') request.post = verbFunc('post') request.put = verbFunc('put') request.patch = verbFunc('patch') -request.del = verbFunc('del') +request.del = verbFunc('delete') +request['delete'] = verbFunc('delete') request.jar = function (store) { return cookies.jar(store) @@ -91,7 +92,7 @@ function wrapRequestMethod (method, options, requester, verb) { target.pool = params.pool || options.pool if (verb) { - target.method = (verb === 'del' ? 'DELETE' : verb.toUpperCase()) + target.method = verb.toUpperCase() } if (isFunction(requester)) { @@ -114,7 +115,7 @@ request.defaults = function (options, requester) { var defaults = wrapRequestMethod(self, options, requester) - var verbs = ['get', 'head', 'post', 'put', 'patch', 'del'] + var verbs = ['get', 'head', 'post', 'put', 'patch', 'del', 'delete'] verbs.forEach(function(verb) { defaults[verb] = wrapRequestMethod(self[verb], options, requester, verb) }) diff --git a/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/index.js b/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/index.js index cc64b902c80..777377a1f77 100644 --- a/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/index.js +++ b/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/index.js @@ -1,3 +1,3 @@ 'use strict'; -module.exports = global.Promise || require('pinkie'); +module.exports = typeof Promise === 'function' ? Promise : require('pinkie'); diff --git a/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/package.json b/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/package.json index 82ca19807dd..438996b7ea8 100644 --- a/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/package.json +++ b/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/package.json @@ -2,20 +2,24 @@ "_args": [ [ "pinkie-promise@^2.0.0", - "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/har-validator" + "/Users/rebecca/code/npm/node_modules/request/node_modules/har-validator" ] ], "_from": "pinkie-promise@>=2.0.0 <3.0.0", - "_id": "pinkie-promise@2.0.0", + "_id": "pinkie-promise@2.0.1", "_inCache": true, "_installable": true, "_location": "/request/har-validator/pinkie-promise", - "_nodeVersion": "4.2.0", + "_nodeVersion": "4.4.1", + "_npmOperationalInternal": { + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/pinkie-promise-2.0.1.tgz_1460309839126_0.3422858319245279" + }, "_npmUser": { "email": "floatdrop@gmail.com", "name": "floatdrop" }, - "_npmVersion": "2.14.7", + "_npmVersion": "2.14.20", "_phantomChildren": {}, "_requested": { "name": "pinkie-promise", @@ -28,11 +32,11 @@ "_requiredBy": [ "/request/har-validator" ], - "_resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.0.tgz", - "_shasum": "4c83538de1f6e660c29e0a13446844f7a7e88259", + "_resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "_shasum": "2135d6dfa7a358c069ac9b178776288228450ffa", "_shrinkwrap": null, "_spec": "pinkie-promise@^2.0.0", - "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/har-validator", + "_where": "/Users/rebecca/code/npm/node_modules/request/node_modules/har-validator", "author": { "email": "floatdrop@gmail.com", "name": "Vsevolod Strukchinsky", @@ -50,8 +54,8 @@ }, "directories": {}, "dist": { - "shasum": "4c83538de1f6e660c29e0a13446844f7a7e88259", - "tarball": "http://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.0.tgz" + "shasum": "2135d6dfa7a358c069ac9b178776288228450ffa", + "tarball": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz" }, "engines": { "node": ">=0.10.0" @@ -59,21 +63,21 @@ "files": [ "index.js" ], - "gitHead": "f90fcae9838bcae7ae1ae4ebc9b29f11e5db4980", + "gitHead": "4a936c09c34ad591a25db93f1216d242de0d6184", "homepage": "https://github.com/floatdrop/pinkie-promise", "keywords": [ + "promise", + "promises", "es2015", "es6", "polyfill", - "ponyfill", - "promise", - "promises" + "ponyfill" ], "license": "MIT", "maintainers": [ { - "name": "floatdrop", - "email": "floatdrop@gmail.com" + "email": "floatdrop@gmail.com", + "name": "floatdrop" } ], "name": "pinkie-promise", @@ -86,5 +90,5 @@ "scripts": { "test": "mocha" }, - "version": "2.0.0" + "version": "2.0.1" } diff --git a/node_modules/request/package.json b/node_modules/request/package.json index 62960bd71a4..6c9fa0ec836 100644 --- a/node_modules/request/package.json +++ b/node_modules/request/package.json @@ -6,14 +6,14 @@ ] ], "_from": "request@latest", - "_id": "request@2.70.0", + "_id": "request@2.72.0", "_inCache": true, "_installable": true, "_location": "/request", "_nodeVersion": "5.9.0", "_npmOperationalInternal": { "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/request-2.70.0.tgz_1459850846109_0.8679330893792212" + "tmp": "tmp/request-2.72.0.tgz_1460901215210_0.9173020373564214" }, "_npmUser": { "email": "simeonvelichkov@gmail.com", @@ -22,7 +22,7 @@ "_npmVersion": "3.8.5", "_phantomChildren": { "ansi-regex": "2.0.0", - "readable-stream": "2.0.6", + "inherits": "2.0.1", "strip-ansi": "3.0.1" }, "_requested": { @@ -38,8 +38,8 @@ "/node-gyp", "/npm-registry-client" ], - "_resolved": "https://registry.npmjs.org/request/-/request-2.70.0.tgz", - "_shasum": "7ecf8437d6fb553e92e2981a411b9ee2aadd7cce", + "_resolved": "https://registry.npmjs.org/request/-/request-2.72.0.tgz", + "_shasum": "0ce3a179512620b10441f14c82e21c12c0ddb4e1", "_shrinkwrap": null, "_spec": "request@latest", "_where": "/Users/rebecca/code/npm", @@ -98,13 +98,13 @@ }, "directories": {}, "dist": { - "shasum": "7ecf8437d6fb553e92e2981a411b9ee2aadd7cce", - "tarball": "https://registry.npmjs.org/request/-/request-2.70.0.tgz" + "shasum": "0ce3a179512620b10441f14c82e21c12c0ddb4e1", + "tarball": "https://registry.npmjs.org/request/-/request-2.72.0.tgz" }, "engines": { "node": ">=0.8.0" }, - "gitHead": "bc781cb49aafedb057719e8b1eb7850979688a85", + "gitHead": "6dcac13642955577592fdafb5ff3cdc8a6ff1b1b", "homepage": "https://github.com/request/request#readme", "license": "Apache-2.0", "main": "index.js", @@ -146,5 +146,5 @@ "util", "utility" ], - "version": "2.70.0" + "version": "2.72.0" } diff --git a/node_modules/request/request.js b/node_modules/request/request.js index 6310e0a6b34..124157e8677 100644 --- a/node_modules/request/request.js +++ b/node_modules/request/request.js @@ -399,7 +399,7 @@ Request.prototype.init = function (options) { } if (self.gzip && !self.hasHeader('accept-encoding')) { - self.setHeader('accept-encoding', 'gzip') + self.setHeader('accept-encoding', 'gzip, deflate') } if (self.uri.auth && !self.hasHeader('authorization')) { @@ -749,7 +749,12 @@ Request.prototype.start = function () { debug('make request', self.uri.href) - self.req = self.httpModule.request(reqOptions) + try { + self.req = self.httpModule.request(reqOptions) + } catch (err) { + self.emit('error', err) + return + } if (self.timing) { self.startTime = new Date().getTime() @@ -915,14 +920,29 @@ Request.prototype.onRequestResponse = function (response) { self._ended = true }) + var noBody = function (code) { + return ( + self.method === 'HEAD' + // Informational + || (code >= 100 && code < 200) + // No Content + || code === 204 + // Not Modified + || code === 304 + ) + } + var responseContent - if (self.gzip) { + if (self.gzip && !noBody(response.statusCode)) { var contentEncoding = response.headers['content-encoding'] || 'identity' contentEncoding = contentEncoding.trim().toLowerCase() if (contentEncoding === 'gzip') { responseContent = zlib.createGunzip() response.pipe(responseContent) + } else if (contentEncoding === 'deflate') { + responseContent = zlib.createInflate() + response.pipe(responseContent) } else { // Since previous versions didn't check for Content-Encoding header, // ignore any invalid values to preserve backwards-compatibility @@ -1006,6 +1026,9 @@ Request.prototype.readResponseBody = function (response) { debug('end event', self.uri.href) if (self._aborted) { debug('aborted', self.uri.href) + // `buffer` is defined in the parent scope and used in a closure it exists for the life of the request. + // This can lead to leaky behavior if the user retains a reference to the request object. + buffer.destroy() return } @@ -1018,6 +1041,9 @@ Request.prototype.readResponseBody = function (response) { } else { response.body = buffer.toString(self.encoding) } + // `buffer` is defined in the parent scope and used in a closure it exists for the life of the Request. + // This can lead to leaky behavior if the user retains a reference to the request object. + buffer.destroy() } else if (strings.length) { // The UTF8 BOM [0xEF,0xBB,0xBF] is converted to [0xFE,0xFF] in the JS UTC16/UCS2 representation. // Strip this value out when the encoding is set to 'utf8', as upstream consumers won't expect it and it breaks JSON.parse(). @@ -1377,7 +1403,9 @@ Request.prototype.write = function () { if (!self._started) { self.start() } - return self.req.write.apply(self.req, arguments) + if (self.req) { + return self.req.write.apply(self.req, arguments) + } } Request.prototype.end = function (chunk) { var self = this @@ -1389,7 +1417,9 @@ Request.prototype.end = function (chunk) { if (!self._started) { self.start() } - self.req.end() + if (self.req) { + self.req.end() + } } Request.prototype.pause = function () { var self = this diff --git a/package.json b/package.json index e221d0454aa..55679fc9bc6 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "read-package-tree": "~5.1.2", "readable-stream": "~2.1.0", "realize-package-specifier": "~3.0.1", - "request": "~2.70.0", + "request": "~2.72.0", "retry": "~0.9.0", "rimraf": "~2.5.2", "semver": "~5.1.0",