Skip to content

Commit 4d3850e

Browse files
author
Lukas Ostendorf
committed
Fix: some clients were not able to authenticate using DIGEST_AUTH
1 parent 0fd86a0 commit 4d3850e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: libraries/ESP8266WebServer/src/ESP8266WebServer.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
static const char AUTHORIZATION_HEADER[] PROGMEM = "Authorization";
4040
static const char qop_auth[] PROGMEM = "qop=auth";
41+
static const char qop_auth_quoted[] PROGMEM = "qop=\"auth\"";
4142
static const char WWW_Authenticate[] PROGMEM = "WWW-Authenticate";
4243
static const char Content_Length[] PROGMEM = "Content-Length";
4344

@@ -165,7 +166,7 @@ bool ESP8266WebServer::authenticate(const char * username, const char * password
165166
}
166167
// parameters for the RFC 2617 newer Digest
167168
String _nc,_cnonce;
168-
if(authReq.indexOf(FPSTR(qop_auth)) != -1) {
169+
if(authReq.indexOf(FPSTR(qop_auth)) != -1 || authReq.indexOf(FPSTR(qop_auth_quoted)) != -1) {
169170
_nc = _extractParam(authReq, F("nc="), ',');
170171
_cnonce = _extractParam(authReq, F("cnonce=\""));
171172
}
@@ -195,7 +196,7 @@ bool ESP8266WebServer::authenticate(const char * username, const char * password
195196
DEBUG_OUTPUT.println("Hash of GET:uri=" + _H2);
196197
#endif
197198
md5.begin();
198-
if(authReq.indexOf(FPSTR(qop_auth)) != -1) {
199+
if(authReq.indexOf(FPSTR(qop_auth)) != -1 || authReq.indexOf(FPSTR(qop_auth_quoted)) != -1) {
199200
md5.add(_H1 + ':' + _nonce + ':' + _nc + ':' + _cnonce + F(":auth:") + _H2);
200201
} else {
201202
md5.add(_H1 + ':' + _nonce + ':' + _H2);

0 commit comments

Comments
 (0)