Skip to content

Commit 2d3c576

Browse files
committed
Fix: WebServer: Digest authentication failed for some clients
Ports: esp8266/Arduino@4d3850e
1 parent a299ddc commit 2d3c576

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333

3434

3535
static const char AUTHORIZATION_HEADER[] = "Authorization";
36-
static const char qop_auth[] = "qop=\"auth\"";
36+
static const char qop_auth[] PROGMEM = "qop=auth";
37+
static const char qop_auth_quoted[] PROGMEM = "qop=\"auth\"";
3738
static const char WWW_Authenticate[] = "WWW-Authenticate";
3839
static const char Content_Length[] = "Content-Length";
3940

@@ -185,7 +186,7 @@ bool WebServer::authenticate(const char * username, const char * password){
185186
}
186187
// parameters for the RFC 2617 newer Digest
187188
String _nc,_cnonce;
188-
if(authReq.indexOf(FPSTR(qop_auth)) != -1) {
189+
if(authReq.indexOf(FPSTR(qop_auth)) != -1 || authReq.indexOf(FPSTR(qop_auth_quoted)) != -1) {
189190
_nc = _extractParam(authReq, F("nc="), ',');
190191
_cnonce = _extractParam(authReq, F("cnonce=\""),'\"');
191192
}
@@ -205,7 +206,7 @@ bool WebServer::authenticate(const char * username, const char * password){
205206
}
206207
log_v("Hash of GET:uri=%s", _H2.c_str());
207208
String _responsecheck = "";
208-
if(authReq.indexOf(FPSTR(qop_auth)) != -1) {
209+
if(authReq.indexOf(FPSTR(qop_auth)) != -1 || authReq.indexOf(FPSTR(qop_auth_quoted)) != -1) {
209210
_responsecheck = md5str(_H1 + ':' + _nonce + ':' + _nc + ':' + _cnonce + F(":auth:") + _H2);
210211
} else {
211212
_responsecheck = md5str(_H1 + ':' + _nonce + ':' + _H2);

0 commit comments

Comments
 (0)