Skip to content

Commit

Permalink
Merge pull request #44 from hapijs/host-header
Browse files Browse the repository at this point in the history
Host header
  • Loading branch information
stongo committed Feb 5, 2015
2 parents 28313f3 + 4b9c685 commit b7cd449
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
4 changes: 2 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down Expand Up @@ -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');
Expand Down

0 comments on commit b7cd449

Please sign in to comment.