allow any "case" for Upgrade

RFC6455:
An |Upgrade| header field containing the value "websocket", treated as an ASCII case-insensitive value.
This commit is contained in:
Markus Sattler
2015-06-17 10:37:20 +02:00
parent f118a13d0f
commit 28b7619419
2 changed files with 14 additions and 8 deletions

View File

@ -319,10 +319,13 @@ void WebSocketsClient::handleHeader(WSclient_t * client) {
client->cCode = headerLine.substring(9, headerLine.indexOf(' ', 9)).toInt();
} else if(headerLine == "Connection: Upgrade") {
client->cIsUpgrade = true;
} else if(headerLine == "Upgrade: websocket") {
client->cIsWebsocket = true;
} else if(headerLine == "Upgrade: WebSocket") {
client->cIsWebsocket = true;
} else if(headerLine.startsWith("Upgrade: ")) {
// 9 = lenght of "Upgrade: "
String low = headerLine.substring(9);
low.toLowerCase();
if(low == "websocket") {
client->cIsWebsocket = true;
}
} else if(headerLine.startsWith("Sec-WebSocket-Accept: ")) {
// 22 = lenght of "Sec-WebSocket-Accept: "
client->cAccept = headerLine.substring(22);