@@ -62,6 +62,7 @@ void WebSocketsClient::begin(const char *host, uint16_t port, const char * url,
6262 _client.cExtensions = " " ;
6363 _client.cVersion = 0 ;
6464 _client.base64Authorization = " " ;
65+ _client.plainAuthorization = " " ;
6566
6667#ifdef ESP8266
6768 randomSeed (RANDOM_REG32);
@@ -228,7 +229,8 @@ void WebSocketsClient::setAuthorization(const char * user, const char * password
228229 */
229230void WebSocketsClient::setAuthorization (const char * auth) {
230231 if (auth) {
231- _client.base64Authorization = auth;
232+ // _client.base64Authorization = auth;
233+ _client.plainAuthorization = auth;
232234 }
233235}
234236
@@ -400,7 +402,7 @@ void WebSocketsClient::sendHeader(WSclient_t * client) {
400402 " Sec-WebSocket-Key: " + client->cKey + " \r\n " ;
401403
402404 if (client->cProtocol .length () > 0 ) {
403- handshake += " Sec-WebSocket-Protocol: " + client->cProtocol + " \r\n " ;
405+ handshake += " Sec-WebSocket-Protocol: " + client->cProtocol + " \r\n " ;
404406 }
405407
406408 if (client->cExtensions .length () > 0 ) {
@@ -411,6 +413,10 @@ void WebSocketsClient::sendHeader(WSclient_t * client) {
411413 handshake += " Authorization: Basic " + client->base64Authorization + " \r\n " ;
412414 }
413415
416+ if (client->plainAuthorization .length () > 0 ) {
417+ handshake += " Authorization: " + client->plainAuthorization + " \r\n " ;
418+ }
419+
414420 handshake += " \r\n " ;
415421
416422 client->tcp ->write (handshake.c_str (), handshake.length ());
@@ -442,7 +448,7 @@ void WebSocketsClient::handleHeader(WSclient_t * client, String * headerLine) {
442448 String headerValue = headerLine->substring (headerLine->indexOf (' :' ) + 2 );
443449
444450 if (headerName.equalsIgnoreCase (" Connection" )) {
445- if (headerValue.indexOf (" Upgrade " ) >= 0 ) {
451+ if (headerValue.indexOf (" upgrade " ) >= 0 ) {
446452 client->cIsUpgrade = true ;
447453 }
448454 } else if (headerName.equalsIgnoreCase (" Upgrade" )) {
0 commit comments