33
33
34
34
35
35
static const char AUTHORIZATION_HEADER[] = " Authorization" ;
36
- static const char qop_auth[] = " qop=auth" ;
36
+ static const char qop_auth[] = " qop=\" auth\" " ;
37
37
static const char WWW_Authenticate[] = " WWW-Authenticate" ;
38
38
static const char Content_Length[] = " Content-Length" ;
39
39
@@ -161,17 +161,17 @@ bool WebServer::authenticate(const char * username, const char * password){
161
161
} else if (authReq.startsWith (F (" Digest" ))) {
162
162
authReq = authReq.substring (7 );
163
163
log_v (" %s" , authReq.c_str ());
164
- String _username = _extractParam (authReq,F (" username=\" " ));
164
+ String _username = _extractParam (authReq,F (" username=\" " ), ' \" ' );
165
165
if (!_username.length () || _username != String (username)) {
166
166
authReq = " " ;
167
167
return false ;
168
168
}
169
169
// extracting required parameters for RFC 2069 simpler Digest
170
- String _realm = _extractParam (authReq, F (" realm=\" " ));
171
- String _nonce = _extractParam (authReq, F (" nonce=\" " ));
172
- String _uri = _extractParam (authReq, F (" uri=\" " ));
173
- String _response = _extractParam (authReq, F (" response=\" " ));
174
- String _opaque = _extractParam (authReq, F (" opaque=\" " ));
170
+ String _realm = _extractParam (authReq, F (" realm=\" " ), ' \" ' );
171
+ String _nonce = _extractParam (authReq, F (" nonce=\" " ), ' \" ' );
172
+ String _uri = _extractParam (authReq, F (" uri=\" " ), ' \" ' );
173
+ String _response = _extractParam (authReq, F (" response=\" " ), ' \" ' );
174
+ String _opaque = _extractParam (authReq, F (" opaque=\" " ), ' \" ' );
175
175
176
176
if ((!_realm.length ()) || (!_nonce.length ()) || (!_uri.length ()) || (!_response.length ()) || (!_opaque.length ())) {
177
177
authReq = " " ;
@@ -185,7 +185,7 @@ bool WebServer::authenticate(const char * username, const char * password){
185
185
String _nc,_cnonce;
186
186
if (authReq.indexOf (FPSTR (qop_auth)) != -1 ) {
187
187
_nc = _extractParam (authReq, F (" nc=" ), ' ,' );
188
- _cnonce = _extractParam (authReq, F (" cnonce=\" " ));
188
+ _cnonce = _extractParam (authReq, F (" cnonce=\" " ), ' \" ' );
189
189
}
190
190
String _H1 = md5str (String (username) + ' :' + _realm + ' :' + String (password));
191
191
log_v (" Hash of user:realm:pass=%s" , _H1.c_str ());
0 commit comments