From 82d0ef040c9dadc9c18dbc9f866c8ac777a8a681 Mon Sep 17 00:00:00 2001 From: Quan HL Date: Thu, 20 Feb 2025 20:09:09 +0700 Subject: [PATCH] fix return Error if invite challenge without authenticate header --- lib/digest-client.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/digest-client.js b/lib/digest-client.js index 062420a..a73505b 100644 --- a/lib/digest-client.js +++ b/lib/digest-client.js @@ -39,6 +39,9 @@ module.exports = class DigestClient { } const header = this.res.statusCode === 407 ? 'proxy-authenticate' : 'www-authenticate' ; + if (!this.res.has(header)) { + return callback(new Error(`missing ${header} in ${this.res.statusCode} response`)); + } const challenge = this._parseChallenge(this.res.get(header)); const ha1 = crypto.createHash('md5');