Minor cleanup on connection request authentication code.
This commit is contained in:
1 parent
3c7f554264
commit
a8ee773a39
2 files changed
+8
-6
No files matched your search
@@ -9,11 +9,12 @@ auth = require './auth'
|
||||
|
||||
connectionRequest = (deviceId, callback) ->
|
||||
conReq = (url, authString, callback) ->
|
||||
if authString
|
||||
url = URL.parse(url)
|
||||
url.headers = {'Authorization' : authString}
|
||||
options = URL.parse(url)
|
||||
|
||||
request = http.get(url, (res) ->
|
||||
if authString
|
||||
options.headers = {'Authorization' : authString}
|
||||
|
||||
request = http.get(options, (res) ->
|
||||
if res.statusCode == 401
|
||||
authHeader = auth.parseAuthHeader(res.headers['www-authenticate'])
|
||||
callback(res.statusCode, authHeader)
|
||||
|
||||
+3
-2
@@ -54,8 +54,9 @@ exports.digest = (username, password, uri, httpMethod, body, authHeader) ->
|
||||
authString += ",realm=\"#{authHeader.realm}\""
|
||||
authString += ",nonce=\"#{authHeader.nonce}\""
|
||||
authString += ",uri=\"#{uri}\""
|
||||
authString += ",qop=\"#{qop}\""
|
||||
authString += ",nc=\"#{nc}\""
|
||||
authString += ",algorithm=#{authHeader.algorithm}" if authHeader.algorithm?
|
||||
authString += ",qop=#{qop}"
|
||||
authString += ",nc=#{nc}"
|
||||
authString += ",cnonce=\"#{cnonce}\""
|
||||
authString += ",response=\"#{response}\""
|
||||
authString += ",opaque=\"#{authHeader.opaque}\""
|
||||
|
||||
Reference in new issue
Block a user