diff --git a/lib/api-functions.coffee b/lib/api-functions.coffee index 6627469..915129e 100644 --- a/lib/api-functions.coffee +++ b/lib/api-functions.coffee @@ -82,7 +82,7 @@ udpConReq = (address, un, key, callback) -> httpConReq = (url, username, password, timeout, callback) -> options = URL.parse(url) # Ensure socket is reused in case of digest authentication - agent = new http.Agent({maxSockets : 1}) + options.agent = new http.Agent({maxSockets : 1}) statusToError = (statusCode) -> switch statusCode diff --git a/lib/auth.coffee b/lib/auth.coffee index 502db68..1089cb8 100644 --- a/lib/auth.coffee +++ b/lib/auth.coffee @@ -72,9 +72,7 @@ exports.digest = (username, password, uri, httpMethod, body, authHeader) -> authString += ",nonce=\"#{authHeader.nonce}\"" authString += ",uri=\"#{uri}\"" authString += ",algorithm=#{authHeader.algorithm}" if authHeader.algorithm? - authString += ",qop=#{qop}" - authString += ",nc=#{nc}" - authString += ",cnonce=\"#{cnonce}\"" + authString += ",qop=#{qop},nc=#{nc},cnonce=\"#{cnonce}\"" if qop? authString += ",response=\"#{response}\"" - authString += ",opaque=\"#{authHeader.opaque}\"" + authString += ",opaque=\"#{authHeader.opaque}\"" if authHeader.opaque? return authString