drachtio-srf 5.0.25 → 5.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -162,10 +162,13 @@ module.exports = class DigestClient {
162
162
  _parseChallenge(digest) {
163
163
  const params = {};
164
164
  if (typeof digest !== 'string') return params;
165
- const prefix = 'Digest ';
166
- const prefixIdx = digest.indexOf(prefix);
167
- if (prefixIdx === -1) return params;
168
- const challenge = digest.substr(prefixIdx + prefix.length);
165
+ // RFC 7235 §2.1: the auth-scheme token is case-insensitive. Some SBCs
166
+ // (e.g. BroadWorks) send "DIGEST"; a case-sensitive match on "Digest "
167
+ // dropped the challenge params, producing realm/nonce="undefined" in the
168
+ // generated re-auth and a perpetual 401.
169
+ const m = /^\s*digest\s+/i.exec(digest);
170
+ if (!m) return params;
171
+ const challenge = digest.substr(m[0].length);
169
172
  const parts = challenge.split(',');
170
173
  const length = parts.length;
171
174
  for (let i = 0; i < length; i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drachtio-srf",
3
- "version": "5.0.25",
3
+ "version": "5.0.26",
4
4
  "description": "drachtio signaling resource framework",
5
5
  "main": "lib/srf.js",
6
6
  "types": "lib/@types/index.d.ts",