diff --git a/lib/index.js b/lib/index.js index 274656a..255ee44 100755 --- a/lib/index.js +++ b/lib/index.js @@ -175,9 +175,6 @@ internals.trimHost = function (host) { this._host = host; - if (!this._host) { - return this._host; - } if (host.indexOf('https://') === 0) { this._host = this._host.substring(8); } @@ -194,7 +191,7 @@ internals.trimHost = function (host) { internals.originParser = function (origin, allowOrigins, request) { var host = internals.trimHost(request.connection.info.uri); - var requestHost = internals.trimHost(request.headers.host); + var requestHost = request.headers.host; this._match = false; // If a same origin request, pass check diff --git a/package.json b/package.json index ea7756c..7988663 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "crumb", "description": "CSRF crumb generation and validation plugin", - "version": "4.0.0", + "version": "4.0.1", "repository": "git://github.com/hapijs/crumb", "bugs": { "url": "https://github.com/hapijs/crumb/issues" diff --git a/test/index.js b/test/index.js index b575865..d17a78a 100755 --- a/test/index.js +++ b/test/index.js @@ -393,7 +393,7 @@ describe('Crumb', function () { expect(err).to.not.exist(); var headers = {}; - headers.host = 'http://localhost:80'; + headers.host = 'localhost:80'; server.inject({ method: 'GET', url: '/1', headers: headers }, function (res) { @@ -443,7 +443,7 @@ describe('Crumb', function () { expect(err).to.not.exist(); - server.inject({ method: 'GET', url: '/1', headers: { host: 'https://localhost:443' } }, function (res) { + server.inject({ method: 'GET', url: '/1', headers: { host: 'localhost:443' } }, function (res) { var header = res.headers['set-cookie']; expect(header[0]).to.contain('crumb');