@@ -62,6 +62,7 @@ void WebSocketsClient::begin(const char *host, uint16_t port, const char * url,
62
62
_client.cExtensions = " " ;
63
63
_client.cVersion = 0 ;
64
64
_client.base64Authorization = " " ;
65
+ _client.plainAuthorization = " " ;
65
66
66
67
#ifdef ESP8266
67
68
randomSeed (RANDOM_REG32);
@@ -228,7 +229,8 @@ void WebSocketsClient::setAuthorization(const char * user, const char * password
228
229
*/
229
230
void WebSocketsClient::setAuthorization (const char * auth) {
230
231
if (auth) {
231
- _client.base64Authorization = auth;
232
+ // _client.base64Authorization = auth;
233
+ _client.plainAuthorization = auth;
232
234
}
233
235
}
234
236
@@ -400,7 +402,7 @@ void WebSocketsClient::sendHeader(WSclient_t * client) {
400
402
" Sec-WebSocket-Key: " + client->cKey + " \r\n " ;
401
403
402
404
if (client->cProtocol .length () > 0 ) {
403
- handshake += " Sec-WebSocket-Protocol: " + client->cProtocol + " \r\n " ;
405
+ handshake += " Sec-WebSocket-Protocol: " + client->cProtocol + " \r\n " ;
404
406
}
405
407
406
408
if (client->cExtensions .length () > 0 ) {
@@ -411,6 +413,10 @@ void WebSocketsClient::sendHeader(WSclient_t * client) {
411
413
handshake += " Authorization: Basic " + client->base64Authorization + " \r\n " ;
412
414
}
413
415
416
+ if (client->plainAuthorization .length () > 0 ) {
417
+ handshake += " Authorization: " + client->plainAuthorization + " \r\n " ;
418
+ }
419
+
414
420
handshake += " \r\n " ;
415
421
416
422
client->tcp ->write (handshake.c_str (), handshake.length ());
@@ -442,7 +448,7 @@ void WebSocketsClient::handleHeader(WSclient_t * client, String * headerLine) {
442
448
String headerValue = headerLine->substring (headerLine->indexOf (' :' ) + 2 );
443
449
444
450
if (headerName.equalsIgnoreCase (" Connection" )) {
445
- if (headerValue.indexOf ( " Upgrade " ) >= 0 ) {
451
+ if (headerValue.equalsIgnoreCase ( " upgrade " ) ) {
446
452
client->cIsUpgrade = true ;
447
453
}
448
454
} else if (headerName.equalsIgnoreCase (" Upgrade" )) {
0 commit comments