Fix a few digest authentication issues

Resolves: #181
This commit is contained in:
Zaid Abdulla committed 2017-03-02 13:01:17 -08:00
1 parent d06d59e342
commit ab26ff2058
2 files changed
+3 -5

No files matched your search

+1 -1
View File
@@ -82,7 +82,7 @@ udpConReq = (address, un, key, callback) ->
httpConReq = (url, username, password, timeout, callback) -> httpConReq = (url, username, password, timeout, callback) ->
options = URL.parse(url) options = URL.parse(url)
# Ensure socket is reused in case of digest authentication # Ensure socket is reused in case of digest authentication
agent = new http.Agent({maxSockets : 1}) options.agent = new http.Agent({maxSockets : 1})
statusToError = (statusCode) -> statusToError = (statusCode) ->
switch statusCode switch statusCode
+2 -4
View File
@@ -72,9 +72,7 @@ exports.digest = (username, password, uri, httpMethod, body, authHeader) ->
authString += ",nonce=\"#{authHeader.nonce}\"" authString += ",nonce=\"#{authHeader.nonce}\""
authString += ",uri=\"#{uri}\"" authString += ",uri=\"#{uri}\""
authString += ",algorithm=#{authHeader.algorithm}" if authHeader.algorithm? authString += ",algorithm=#{authHeader.algorithm}" if authHeader.algorithm?
authString += ",qop=#{qop}" authString += ",qop=#{qop},nc=#{nc},cnonce=\"#{cnonce}\"" if qop?
authString += ",nc=#{nc}"
authString += ",cnonce=\"#{cnonce}\""
authString += ",response=\"#{response}\"" authString += ",response=\"#{response}\""
authString += ",opaque=\"#{authHeader.opaque}\"" authString += ",opaque=\"#{authHeader.opaque}\"" if authHeader.opaque?
return authString return authString