Add support for Arduino 3.0.0

This commit is contained in:
me-no-dev
2024-06-04 13:50:37 +03:00
parent f71e3d427b
commit 17a8d44216
5 changed files with 20 additions and 3 deletions

View File

@@ -12,7 +12,7 @@
"type": "git", "type": "git",
"url": "https://github.com/me-no-dev/ESPAsyncWebServer.git" "url": "https://github.com/me-no-dev/ESPAsyncWebServer.git"
}, },
"version": "1.2.3", "version": "1.2.4",
"license": "LGPL-3.0", "license": "LGPL-3.0",
"frameworks": "arduino", "frameworks": "arduino",
"platforms": ["espressif8266", "espressif32"], "platforms": ["espressif8266", "espressif32"],

View File

@@ -1,5 +1,5 @@
name=ESP Async WebServer name=ESP Async WebServer
version=1.2.3 version=1.2.4
author=Me-No-Dev author=Me-No-Dev
maintainer=Me-No-Dev maintainer=Me-No-Dev
sentence=Async Web Server for ESP8266 and ESP31B sentence=Async Web Server for ESP8266 and ESP31B

View File

@@ -19,6 +19,11 @@
*/ */
#include "Arduino.h" #include "Arduino.h"
#include "AsyncEventSource.h" #include "AsyncEventSource.h"
#ifdef ESP32
#if ESP_IDF_VERSION_MAJOR >= 5
#include "rom/ets_sys.h"
#endif
#endif
static String generateEventMessage(const char *message, const char *event, uint32_t id, uint32_t reconnect){ static String generateEventMessage(const char *message, const char *event, uint32_t id, uint32_t reconnect){
String ev = ""; String ev = "";

View File

@@ -829,7 +829,7 @@ void AsyncWebSocketClient::binary(AsyncWebSocketMessageBuffer * buffer)
IPAddress AsyncWebSocketClient::remoteIP() { IPAddress AsyncWebSocketClient::remoteIP() {
if(!_client) { if(!_client) {
return IPAddress(0U); return IPAddress((uint32_t)0U);
} }
return _client->remoteIP(); return _client->remoteIP();
} }
@@ -1259,9 +1259,15 @@ AsyncWebSocketResponse::AsyncWebSocketResponse(const String& key, AsyncWebSocket
(String&)key += WS_STR_UUID; (String&)key += WS_STR_UUID;
mbedtls_sha1_context ctx; mbedtls_sha1_context ctx;
mbedtls_sha1_init(&ctx); mbedtls_sha1_init(&ctx);
#if ESP_IDF_VERSION_MAJOR < 5
mbedtls_sha1_starts_ret(&ctx); mbedtls_sha1_starts_ret(&ctx);
mbedtls_sha1_update_ret(&ctx, (const unsigned char*)key.c_str(), key.length()); mbedtls_sha1_update_ret(&ctx, (const unsigned char*)key.c_str(), key.length());
mbedtls_sha1_finish_ret(&ctx, hash); mbedtls_sha1_finish_ret(&ctx, hash);
#else
mbedtls_sha1_starts(&ctx);
mbedtls_sha1_update(&ctx, (const unsigned char*)key.c_str(), key.length());
mbedtls_sha1_finish(&ctx, hash);
#endif
mbedtls_sha1_free(&ctx); mbedtls_sha1_free(&ctx);
#endif #endif
base64_encodestate _state; base64_encodestate _state;

View File

@@ -71,9 +71,15 @@ static bool getMD5(uint8_t * data, uint16_t len, char * output){//33 bytes or mo
memset(_buf, 0x00, 16); memset(_buf, 0x00, 16);
#ifdef ESP32 #ifdef ESP32
mbedtls_md5_init(&_ctx); mbedtls_md5_init(&_ctx);
#if ESP_IDF_VERSION_MAJOR < 5
mbedtls_md5_starts_ret(&_ctx); mbedtls_md5_starts_ret(&_ctx);
mbedtls_md5_update_ret(&_ctx, data, len); mbedtls_md5_update_ret(&_ctx, data, len);
mbedtls_md5_finish_ret(&_ctx, _buf); mbedtls_md5_finish_ret(&_ctx, _buf);
#else
mbedtls_md5_starts(&_ctx);
mbedtls_md5_update(&_ctx, data, len);
mbedtls_md5_finish(&_ctx, _buf);
#endif
#else #else
MD5Init(&_ctx); MD5Init(&_ctx);
MD5Update(&_ctx, data, len); MD5Update(&_ctx, data, len);