diff options
Diffstat (limited to 'deps/npm/node_modules/request/node_modules/aws4')
-rw-r--r-- | deps/npm/node_modules/request/node_modules/aws4/aws4.js | 21 | ||||
-rw-r--r-- | deps/npm/node_modules/request/node_modules/aws4/package.json | 24 |
2 files changed, 27 insertions, 18 deletions
diff --git a/deps/npm/node_modules/request/node_modules/aws4/aws4.js b/deps/npm/node_modules/request/node_modules/aws4/aws4.js index a54318065b..0cff0f0ea3 100644 --- a/deps/npm/node_modules/request/node_modules/aws4/aws4.js +++ b/deps/npm/node_modules/request/node_modules/aws4/aws4.js @@ -118,14 +118,14 @@ RequestSigner.prototype.prepareRequest = function() { if (request.body && !headers['Content-Length'] && !headers['content-length']) headers['Content-Length'] = Buffer.byteLength(request.body) - if (this.credentials.sessionToken) + if (this.credentials.sessionToken && !headers['X-Amz-Security-Token'] && !headers['x-amz-security-token']) headers['X-Amz-Security-Token'] = this.credentials.sessionToken - if (this.service === 's3') + if (this.service === 's3' && !headers['X-Amz-Content-Sha256'] && !headers['x-amz-content-sha256']) headers['X-Amz-Content-Sha256'] = hash(this.request.body || '', 'hex') - if (headers['X-Amz-Date']) - this.datetime = headers['X-Amz-Date'] + if (headers['X-Amz-Date'] || headers['x-amz-date']) + this.datetime = headers['X-Amz-Date'] || headers['x-amz-date'] else headers['X-Amz-Date'] = this.getDateTime() } @@ -202,13 +202,22 @@ RequestSigner.prototype.canonicalString = function() { var pathStr = this.parsedPath.path, query = this.parsedPath.query, + headers = this.request.headers, queryStr = '', normalizePath = this.service !== 's3', decodePath = this.service === 's3' || this.request.doNotEncodePath, decodeSlashesInPath = this.service === 's3', firstValOnly = this.service === 's3', - bodyHash = this.service === 's3' && this.request.signQuery ? 'UNSIGNED-PAYLOAD' : - (this.isCodeCommitGit ? '' : hash(this.request.body || '', 'hex')) + bodyHash + + if (this.service === 's3' && this.request.signQuery) { + bodyHash = 'UNSIGNED-PAYLOAD' + } else if (this.isCodeCommitGit) { + bodyHash = '' + } else { + bodyHash = headers['X-Amz-Content-Sha256'] || headers['x-amz-content-sha256'] || + hash(this.request.body || '', 'hex') + } if (query) { queryStr = encodeRfc3986(querystring.stringify(Object.keys(query).sort().reduce(function(obj, key) { diff --git a/deps/npm/node_modules/request/node_modules/aws4/package.json b/deps/npm/node_modules/request/node_modules/aws4/package.json index 4e7caf0d30..65b973a7b3 100644 --- a/deps/npm/node_modules/request/node_modules/aws4/package.json +++ b/deps/npm/node_modules/request/node_modules/aws4/package.json @@ -10,23 +10,23 @@ "spec": ">=1.2.1 <2.0.0", "type": "range" }, - "/Users/ogd/Documents/projects/npm/npm/node_modules/request" + "/Users/zkat/Documents/code/npm/node_modules/request" ] ], "_from": "aws4@>=1.2.1 <2.0.0", - "_id": "aws4@1.5.0", + "_id": "aws4@1.6.0", "_inCache": true, "_location": "/request/aws4", "_nodeVersion": "4.5.0", "_npmOperationalInternal": { - "host": "packages-16-east.internal.npmjs.com", - "tmp": "tmp/aws4-1.5.0.tgz_1476226259635_0.2796843808609992" + "host": "packages-18-east.internal.npmjs.com", + "tmp": "tmp/aws4-1.6.0.tgz_1486481933920_0.6127187723759562" }, "_npmUser": { "name": "hichaelmart", "email": "michael.hart.au@gmail.com" }, - "_npmVersion": "2.15.11", + "_npmVersion": "4.0.5", "_phantomChildren": {}, "_requested": { "raw": "aws4@^1.2.1", @@ -40,11 +40,11 @@ "_requiredBy": [ "/request" ], - "_resolved": "https://registry.npmjs.org/aws4/-/aws4-1.5.0.tgz", - "_shasum": "0a29ffb79c31c9e712eeb087e8e7a64b4a56d755", + "_resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", + "_shasum": "83ef5ca860b2b32e4a0deedee8c771b9db57471e", "_shrinkwrap": null, "_spec": "aws4@^1.2.1", - "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request", + "_where": "/Users/zkat/Documents/code/npm/node_modules/request", "author": { "name": "Michael Hart", "email": "michael.hart.au@gmail.com", @@ -61,10 +61,10 @@ }, "directories": {}, "dist": { - "shasum": "0a29ffb79c31c9e712eeb087e8e7a64b4a56d755", - "tarball": "https://registry.npmjs.org/aws4/-/aws4-1.5.0.tgz" + "shasum": "83ef5ca860b2b32e4a0deedee8c771b9db57471e", + "tarball": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz" }, - "gitHead": "ba136334ee08884c6042c8578a22e376233eef34", + "gitHead": "74bf0b64d1e8cbcd184964999c7ef53f52d7ad32", "homepage": "https://github.com/mhart/aws4#readme", "keywords": [ "amazon", @@ -136,5 +136,5 @@ "scripts": { "test": "mocha ./test/fast.js ./test/slow.js -b -t 100s -R list" }, - "version": "1.5.0" + "version": "1.6.0" } |