Skip to content

Commit

Permalink
Add support for Arduino 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
me-no-dev committed Jun 4, 2024
1 parent f71e3d4 commit 17a8d44
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"type": "git",
"url": "https://github.com/me-no-dev/ESPAsyncWebServer.git"
},
"version": "1.2.3",
"version": "1.2.4",
"license": "LGPL-3.0",
"frameworks": "arduino",
"platforms": ["espressif8266", "espressif32"],
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ESP Async WebServer
version=1.2.3
version=1.2.4
author=Me-No-Dev
maintainer=Me-No-Dev
sentence=Async Web Server for ESP8266 and ESP31B
Expand Down
5 changes: 5 additions & 0 deletions src/AsyncEventSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
*/
#include "Arduino.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){
String ev = "";
Expand Down
8 changes: 7 additions & 1 deletion src/AsyncWebSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ void AsyncWebSocketClient::binary(AsyncWebSocketMessageBuffer * buffer)

IPAddress AsyncWebSocketClient::remoteIP() {
if(!_client) {
return IPAddress(0U);
return IPAddress((uint32_t)0U);
}
return _client->remoteIP();
}
Expand Down Expand Up @@ -1259,9 +1259,15 @@ AsyncWebSocketResponse::AsyncWebSocketResponse(const String& key, AsyncWebSocket
(String&)key += WS_STR_UUID;
mbedtls_sha1_context ctx;
mbedtls_sha1_init(&ctx);
#if ESP_IDF_VERSION_MAJOR < 5
mbedtls_sha1_starts_ret(&ctx);
mbedtls_sha1_update_ret(&ctx, (const unsigned char*)key.c_str(), key.length());
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);
#endif
base64_encodestate _state;
Expand Down
6 changes: 6 additions & 0 deletions src/WebAuthentication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,15 @@ static bool getMD5(uint8_t * data, uint16_t len, char * output){//33 bytes or mo
memset(_buf, 0x00, 16);
#ifdef ESP32
mbedtls_md5_init(&_ctx);
#if ESP_IDF_VERSION_MAJOR < 5
mbedtls_md5_starts_ret(&_ctx);
mbedtls_md5_update_ret(&_ctx, data, len);
mbedtls_md5_finish_ret(&_ctx, _buf);
#else
mbedtls_md5_starts(&_ctx);
mbedtls_md5_update(&_ctx, data, len);
mbedtls_md5_finish(&_ctx, _buf);
#endif
#else
MD5Init(&_ctx);
MD5Update(&_ctx, data, len);
Expand Down

0 comments on commit 17a8d44

Please sign in to comment.