1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-20 18:23:21 +00:00

Fixed bug that prevented digest/auth-int from correctly inserting entity body hash into the response.

This commit is contained in:
Bryan Roe
2022-07-01 10:45:23 -07:00
parent 963beb2b25
commit 25749eccaa
2 changed files with 2 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@@ -81,14 +81,13 @@ function generateAuthHeaders(imsg, options, digest)
{ {
if (!(auth = digest._auth)) { return; } if (!(auth = digest._auth)) { return; }
} }
if (digest._auth.qop == 'auth-int' && options.oneshotEntity == null) { return; } // For auth-int, we need to hash the entity body, so if we don't have it, we must return if (digest._auth.qop == 'auth-int' && options.oneshotEntity == null) { return; } // For auth-int, we need to hash the entity body, so if we don't have it, we must return
var step1 = digest._options.username + ':' + auth.realm + ':' + digest._options.password; var step1 = digest._options.username + ':' + auth.realm + ':' + digest._options.password;
auth.step1 = md5.syncHash(step1).toString('hex').toLowerCase(); auth.step1 = md5.syncHash(step1).toString('hex').toLowerCase();
var step2 = options.method + ':' + options.path; var step2 = options.method + ':' + options.path;
if (qop == 'auth-int' && options.oneshotEntity != null) { step2 += (':' + md5.syncHash(options.oneshotEntity).toString('hex').toLowerCase()); } if (auth.qop == 'auth-int' && options.oneshotEntity != null) { step2 += (':' + md5.syncHash(options.oneshotEntity).toString('hex').toLowerCase()); }
auth.step2 = md5.syncHash(step2).toString('hex').toLowerCase(); auth.step2 = md5.syncHash(step2).toString('hex').toLowerCase();
if (auth.qop == null) if (auth.qop == null)