@@ -20,26 +20,26 @@ ESP8266HTTPUpdateServer::ESP8266HTTPUpdateServer(bool serial_debug)
2020{
2121 _serial_output = serial_debug;
2222 _server = NULL ;
23- _username = NULL ;
24- _password = NULL ;
23+ _username = emptyString ;
24+ _password = emptyString ;
2525 _authenticated = false ;
2626}
2727
28- void ESP8266HTTPUpdateServer::setup (ESP8266WebServer *server, const char * path, const char * username, const char * password)
28+ void ESP8266HTTPUpdateServer::setup (ESP8266WebServer *server, const String& path, const String& username, const String& password)
2929{
3030 _server = server;
31- _username = ( char *) username;
32- _password = ( char *) password;
31+ _username = username;
32+ _password = password;
3333
3434 // handler for the /update form page
35- _server->on (path, HTTP_GET, [&](){
36- if (_username != NULL && _password != NULL && !_server->authenticate (_username, _password))
35+ _server->on (path. c_str () , HTTP_GET, [&](){
36+ if (_username != emptyString && _password != emptyString && !_server->authenticate (_username. c_str () , _password. c_str () ))
3737 return _server->requestAuthentication ();
3838 _server->send_P (200 , PSTR (" text/html" ), serverIndex);
3939 });
4040
4141 // handler for the /update form POST (once file upload finishes)
42- _server->on (path, HTTP_POST, [&](){
42+ _server->on (path. c_str () , HTTP_POST, [&](){
4343 if (!_authenticated)
4444 return _server->requestAuthentication ();
4545 if (Update.hasError ()) {
@@ -61,7 +61,7 @@ void ESP8266HTTPUpdateServer::setup(ESP8266WebServer *server, const char * path,
6161 if (_serial_output)
6262 Serial.setDebugOutput (true );
6363
64- _authenticated = (_username == NULL || _password == NULL || _server->authenticate (_username, _password));
64+ _authenticated = (_username == emptyString || _password == emptyString || _server->authenticate (_username. c_str () , _password. c_str () ));
6565 if (!_authenticated){
6666 if (_serial_output)
6767 Serial.printf (" Unauthenticated Update\n " );
0 commit comments