diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..efb0983 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - "8" diff --git a/lib/ntlm.js b/lib/ntlm.js index 4d2863b..da005e8 100755 --- a/lib/ntlm.js +++ b/lib/ntlm.js @@ -226,7 +226,8 @@ exports.challengeHeader = function (hostname, domain) { }; exports.responseHeader = function (res, url, domain, username, password) { - var serverNonce = new Buffer((res.headers['www-authenticate'].match(/^NTLM\s+(.+?)(,|\s+|$)/) || [])[1], 'base64'); + var authHeader = (typeof res.headers.get === 'function') ? res.headers.get('www-authenticate') : res.headers['www-authenticate']; + var serverNonce = new Buffer((authHeader.match(/^NTLM\s+(.+?)(,|\s+|$)/) || [])[1], 'base64'); var hostname = require('url').parse(url).hostname; return 'NTLM ' + exports.encodeType3(username, hostname, domain, exports.decodeType2(serverNonce), password).toString('base64') }; diff --git a/package.json b/package.json index af547dd..028eb42 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ntlm", - "version": "0.1.3", + "version": "0.1.4", "devDependencies": { "nodeunit": "*" }, @@ -18,5 +18,8 @@ ], "main": "lib/ntlm.js", "description": "NTLM authentication and Samba LM/NT hash library", - "homepage": "https://github.com/tcr/node-ntlm" + "homepage": "https://github.com/tcr/node-ntlm", + "scripts": { + "test": "node ./run_tests.js" + } }