1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-29 12:16:48 +03:00

Fix: some clients were not able to authenticate using DIGEST_AUTH (#5506)

This commit is contained in:
lukasostendorf 2018-12-18 18:52:14 +01:00 committed by Develo
parent 34e90f3c56
commit 3a36501d6d

View File

@ -38,6 +38,7 @@
static const char AUTHORIZATION_HEADER[] PROGMEM = "Authorization";
static const char qop_auth[] PROGMEM = "qop=auth";
static const char qop_auth_quoted[] PROGMEM = "qop=\"auth\"";
static const char WWW_Authenticate[] PROGMEM = "WWW-Authenticate";
static const char Content_Length[] PROGMEM = "Content-Length";
@ -165,7 +166,7 @@ bool ESP8266WebServer::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=\""));
}
@ -195,7 +196,7 @@ bool ESP8266WebServer::authenticate(const char * username, const char * password
DEBUG_OUTPUT.println("Hash of GET:uri=" + _H2);
#endif
md5.begin();
if(authReq.indexOf(FPSTR(qop_auth)) != -1) {
if(authReq.indexOf(FPSTR(qop_auth)) != -1 || authReq.indexOf(FPSTR(qop_auth_quoted)) != -1) {
md5.add(_H1 + ':' + _nonce + ':' + _nc + ':' + _cnonce + F(":auth:") + _H2);
} else {
md5.add(_H1 + ':' + _nonce + ':' + _H2);