NPM Dependencies UPDATE
This commit is contained in:
1 parent
d3bc5e34f6
commit
5bfb4ff32a
732 files changed
+13367
-62155
No files matched your search
+16
-14
@@ -1,12 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
// Load modules
|
||||
|
||||
var Sntp = require('sntp');
|
||||
var Boom = require('boom');
|
||||
const Sntp = require('sntp');
|
||||
const Boom = require('boom');
|
||||
|
||||
|
||||
// Declare internals
|
||||
|
||||
var internals = {};
|
||||
const internals = {};
|
||||
|
||||
|
||||
exports.version = function () {
|
||||
@@ -29,7 +31,7 @@ internals.hostHeaderRegex = /^(?:(?:\r\n)?\s)*((?:[^:]+)|(?:\[[^\]]+\]))(?::(\d+
|
||||
exports.parseHost = function (req, hostHeaderName) {
|
||||
|
||||
hostHeaderName = (hostHeaderName ? hostHeaderName.toLowerCase() : 'host');
|
||||
var hostHeader = req.headers[hostHeaderName];
|
||||
const hostHeader = req.headers[hostHeaderName];
|
||||
if (!hostHeader) {
|
||||
return null;
|
||||
}
|
||||
@@ -38,7 +40,7 @@ exports.parseHost = function (req, hostHeaderName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var hostParts = hostHeader.match(internals.hostHeaderRegex);
|
||||
const hostParts = hostHeader.match(internals.hostHeaderRegex);
|
||||
if (!hostParts) {
|
||||
return null;
|
||||
}
|
||||
@@ -72,7 +74,7 @@ exports.parseRequest = function (req, options) {
|
||||
|
||||
// Obtain host and port information
|
||||
|
||||
var host;
|
||||
let host;
|
||||
if (!options.host ||
|
||||
!options.port) {
|
||||
|
||||
@@ -82,7 +84,7 @@ exports.parseRequest = function (req, options) {
|
||||
}
|
||||
}
|
||||
|
||||
var request = {
|
||||
const request = {
|
||||
method: req.method,
|
||||
url: req.url,
|
||||
host: options.host || host.name,
|
||||
@@ -125,24 +127,24 @@ exports.parseAuthorizationHeader = function (header, keys) {
|
||||
return Boom.badRequest('Header length too long');
|
||||
}
|
||||
|
||||
var headerParts = header.match(internals.authHeaderRegex);
|
||||
const headerParts = header.match(internals.authHeaderRegex);
|
||||
if (!headerParts) {
|
||||
return Boom.badRequest('Invalid header syntax');
|
||||
}
|
||||
|
||||
var scheme = headerParts[1];
|
||||
const scheme = headerParts[1];
|
||||
if (scheme.toLowerCase() !== 'hawk') {
|
||||
return Boom.unauthorized(null, 'Hawk');
|
||||
}
|
||||
|
||||
var attributesString = headerParts[2];
|
||||
const attributesString = headerParts[2];
|
||||
if (!attributesString) {
|
||||
return Boom.badRequest('Invalid header syntax');
|
||||
}
|
||||
|
||||
var attributes = {};
|
||||
var errorMessage = '';
|
||||
var verify = attributesString.replace(/(\w+)="([^"\\]*)"\s*(?:,\s*|$)/g, function ($0, $1, $2) {
|
||||
const attributes = {};
|
||||
let errorMessage = '';
|
||||
const verify = attributesString.replace(/(\w+)="([^"\\]*)"\s*(?:,\s*|$)/g, ($0, $1, $2) => {
|
||||
|
||||
// Check valid attribute names
|
||||
|
||||
@@ -179,6 +181,6 @@ exports.parseAuthorizationHeader = function (header, keys) {
|
||||
|
||||
exports.unauthorized = function (message, attributes) {
|
||||
|
||||
return Boom.unauthorized(message, 'Hawk', attributes);
|
||||
return Boom.unauthorized(message || null, 'Hawk', attributes);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user