Skip to content

Commit 81e567b

Browse files
committed
send 401 header too if auth string is empty #116
1 parent 1afe317 commit 81e567b

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/WebSocketsServer.cpp

+7-11
Original file line numberDiff line numberDiff line change
@@ -766,17 +766,13 @@ void WebSocketsServer::handleHeader(WSclient_t * client, String * headerLine) {
766766
}
767767

768768
if(_base64Authorization.length() > 0) {
769-
if(client->base64Authorization.length() > 0) {
770-
String auth = WEBSOCKETS_STRING("Basic ");
771-
auth += _base64Authorization;
772-
if(auth != client->base64Authorization) {
773-
DEBUG_WEBSOCKETS("[WS-Server][%d][handleHeader] HTTP Authorization failed!\n", client->num);
774-
handleAuthorizationFailed(client);
775-
return;
776-
}
777-
} else {
778-
ok = false;
779-
}
769+
String auth = WEBSOCKETS_STRING("Basic ");
770+
auth += _base64Authorization;
771+
if(auth != client->base64Authorization) {
772+
DEBUG_WEBSOCKETS("[WS-Server][%d][handleHeader] HTTP Authorization failed!\n", client->num);
773+
handleAuthorizationFailed(client);
774+
return;
775+
}
780776
}
781777

782778
if(ok) {

0 commit comments

Comments
 (0)