node-http-digest-client icon indicating copy to clipboard operation
node-http-digest-client copied to clipboard

Failure when server response header is not valid

Open yeudit opened this issue 9 years ago • 1 comments

Hey,

I'm using your module and when tried to make a request I got an exception:

TypeError: Cannot read property 'length' of null at parseChallenge [as _parseChallenge] /home/yeudit/workspace/att/breeze/System/core/node_modules/http-digest-client/http-digest-client.js:112:15 at handleResponse [as _handleResponse] /home/yeudit/workspace/att/breeze/System/core/node_modules/http-digest-client/http-digest-client.js:40:26 at ClientRequest. /home/yeudit/workspace/att/breeze/System/core/node_modules/http-digest-client/http-digest-client.js:29:12

the response header was: Digest nonce="907419fb8e9c9d12e1270a7b7117b74c", opaque="510ed2366f84e2e3b5dcd95df026cdde", realm="[email protected]", qop=auth

and the failure was because of the 'qop' parameter https://github.com/simme/node-http-digest-client/blob/master/http-digest-client.js#L106

how can I prevent this failure? or maybe you have to add a fix?

Thanks

yeudit avatar Mar 09 '15 08:03 yeudit

A bit late to the party, but changing that line to if (part && part.length > 2) { solved it for me.

poacher2k avatar Oct 19 '18 12:10 poacher2k