|
20 | 20 | */ |
21 | 21 | #include "Arduino.h" |
22 | 22 | #include "AsyncWebSocket.h" |
| 23 | +#include "../../SerialLog.h" |
23 | 24 | #include <libb64/cencode.h> |
24 | 25 |
|
25 | | -#ifdef ESP8266 |
26 | | - #include <Hash.h> |
27 | | -#else |
28 | | - #if ESP_ARDUINO_VERSION_MAJOR > 2 |
29 | | - #include "SHA1Builder.h" |
30 | | - #else |
31 | | - #include "mbedtls/sha1.h" |
32 | | - #endif |
| 26 | +#ifdef ESP8266 |
| 27 | + #include <Hash.h> |
| 28 | +#else |
| 29 | + #if ESP_ARDUINO_VERSION_MAJOR > 2 |
| 30 | + #include "SHA1Builder.h" |
| 31 | + #else |
| 32 | + #include "mbedtls/sha1.h" |
| 33 | + #endif |
33 | 34 | #endif |
34 | 35 |
|
35 | 36 | #define MAX_PRINTF_LEN 64 |
@@ -622,7 +623,7 @@ void AsyncWebSocketClient::_queueMessage(AsyncWebSocketMessage *dataMessage){ |
622 | 623 | return; |
623 | 624 | } |
624 | 625 | if(_messageQueue.length() >= WS_MAX_QUEUED_MESSAGES){ |
625 | | - log_e("ERROR: Too many messages queued"); |
| 626 | + log_error("ERROR: Too many messages queued"); |
626 | 627 | // Serial.printf("%u Q3\n", _clientId); |
627 | 628 | delete dataMessage; |
628 | 629 | } else { |
@@ -769,7 +770,7 @@ void AsyncWebSocketClient::_onData(void *pbuf, size_t plen){ |
769 | 770 | } else if(_pinfo.opcode < 8){//continuation or text/binary frame |
770 | 771 | _server->_handleEvent(this, WS_EVT_DATA, (void *)&_pinfo, data, datalen); |
771 | 772 | if (_pinfo.final) _pinfo.num = 0; |
772 | | - else _pinfo.num += 1; |
| 773 | + else _pinfo.num += 1; |
773 | 774 | } |
774 | 775 | } else { |
775 | 776 | //os_printf("frame error: len: %u, index: %llu, total: %llu\n", datalen, _pinfo.index, _pinfo.len); |
@@ -1265,14 +1266,14 @@ void AsyncWebSocket::handleRequest(AsyncWebServerRequest *request){ |
1265 | 1266 | if((_username.length() && _password.length()) && !request->authenticate(_username.c_str(), _password.c_str())){ |
1266 | 1267 | return request->requestAuthentication(); |
1267 | 1268 | } |
1268 | | -////////////////////////////////////////// |
| 1269 | +////////////////////////////////////////// |
1269 | 1270 | if(_handshakeHandler != nullptr){ |
1270 | 1271 | if(!_handshakeHandler(request)){ |
1271 | 1272 | request->send(401); |
1272 | 1273 | return; |
1273 | 1274 | } |
1274 | 1275 | } |
1275 | | -////////////////////////////////////////// |
| 1276 | +////////////////////////////////////////// |
1276 | 1277 | AsyncWebHeader* version = request->getHeader(WS_STR_VERSION); |
1277 | 1278 | if(version->value().toInt() != 13){ |
1278 | 1279 | AsyncWebServerResponse *response = request->beginResponse(400); |
@@ -1360,7 +1361,7 @@ AsyncWebSocketResponse::AsyncWebSocketResponse(const String& key, AsyncWebSocket |
1360 | 1361 | sha1.calculate(); |
1361 | 1362 | sha1.getBytes(hash); |
1362 | 1363 | #else |
1363 | | - |
| 1364 | + |
1364 | 1365 | (String&)key += WS_STR_UUID; |
1365 | 1366 | mbedtls_sha1_context ctx; |
1366 | 1367 | mbedtls_sha1_init(&ctx); |
|
0 commit comments