Fix: WebServer: Digest authentication failed for some clients

Ports: 4d3850e87e
This commit is contained in:
me-no-dev 2021-03-19 02:10:16 +02:00
parent a299ddc99e
commit 2d3c57635d

View File

@ -33,7 +33,8 @@
static const char AUTHORIZATION_HEADER[] = "Authorization";
static const char qop_auth[] = "qop=\"auth\"";
static const char qop_auth[] PROGMEM = "qop=auth";
static const char qop_auth_quoted[] PROGMEM = "qop=\"auth\"";
static const char WWW_Authenticate[] = "WWW-Authenticate";
static const char Content_Length[] = "Content-Length";
@ -185,7 +186,7 @@ bool WebServer::authenticate(const char * username, const char * password){
}
// parameters for the RFC 2617 newer Digest
String _nc,_cnonce;
if(authReq.indexOf(FPSTR(qop_auth)) != -1) {
if(authReq.indexOf(FPSTR(qop_auth)) != -1 || authReq.indexOf(FPSTR(qop_auth_quoted)) != -1) {
_nc = _extractParam(authReq, F("nc="), ',');
_cnonce = _extractParam(authReq, F("cnonce=\""),'\"');
}
@ -205,7 +206,7 @@ bool WebServer::authenticate(const char * username, const char * password){
}
log_v("Hash of GET:uri=%s", _H2.c_str());
String _responsecheck = "";
if(authReq.indexOf(FPSTR(qop_auth)) != -1) {
if(authReq.indexOf(FPSTR(qop_auth)) != -1 || authReq.indexOf(FPSTR(qop_auth_quoted)) != -1) {
_responsecheck = md5str(_H1 + ':' + _nonce + ':' + _nc + ':' + _cnonce + F(":auth:") + _H2);
} else {
_responsecheck = md5str(_H1 + ':' + _nonce + ':' + _H2);