Skip to content

Commit 1766a1c

Browse files
committed
Make digest qop regex more robust (see request#730)
1 parent fedd5ca commit 1766a1c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

request.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ Request.prototype.onResponse = function (response) {
725725

726726
var ha1 = md5(self._user + ':' + challenge.realm + ':' + self._pass)
727727
var ha2 = md5(self.method + ':' + self.uri.path)
728-
var qop = /(^|,)auth($|,)/.test(challenge.qop) && 'auth'
728+
var qop = /(^|,)\s*auth\s*($|,)/.test(challenge.qop) && 'auth'
729729
var nc = qop && '00000001'
730730
var cnonce = qop && uuid().replace(/-/g, '')
731731
var digestResponse = qop ? md5(ha1 + ':' + challenge.nonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + ha2) : md5(ha1 + ':' + challenge.nonce + ':' + ha2)

0 commit comments

Comments
 (0)