Skip to content

Commit

Permalink
Merge pull request #1474 from erykwalder/master
Browse files Browse the repository at this point in the history
Require Colon in Basic Auth
  • Loading branch information
nylen committed Mar 16, 2015
2 parents 41984f9 + 1080332 commit 1774b03
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion lib/auth.js
Expand Up @@ -26,7 +26,7 @@ Auth.prototype.basic = function (user, pass, sendImmediately) {
self.user = user
self.pass = pass
self.hasAuth = true
var header = typeof pass !== 'undefined' ? user + ':' + pass : user
var header = user + ':' + (pass || '')
if (sendImmediately || typeof sendImmediately === 'undefined') {
var authHeader = 'Basic ' + toBase64(header)
self.sentAuth = true
Expand Down
2 changes: 0 additions & 2 deletions tests/test-basic-auth.js
Expand Up @@ -22,8 +22,6 @@ tape('setup', function(t) {
ok = true
} else if ( req.headers.authorization === 'Basic ' + new Buffer(':pass').toString('base64')) {
ok = true
} else if ( req.headers.authorization === 'Basic ' + new Buffer('user').toString('base64')) {
ok = true
} else {
// Bad auth header, don't send back WWW-Authenticate header
ok = false
Expand Down

0 comments on commit 1774b03

Please sign in to comment.