Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Simple Async HTTPS Request library, supporting GET, POST, PUT, PATCH, DELETE and HEAD, on top of AsyncTCP_SSL library for ESP32/S2/S3/C3, WT32_ETH01 (ESP32 + LAN8720), ESP32 using LwIP ENC28J60, W5500, W6100 or LAN8720

License

NotificationsYou must be signed in to change notification settings

khoih-prog/AsyncHTTPSRequest_ESP32_Ethernet

Repository files navigation

arduino-library-badgeGitHub releasecontributions welcomeGitHub issues

Donate to my libraries using BuyMeACoffee



Table of Contents



Important notes for WT32_ETH01

ESP32 Core v2.0.0+ introduces new enum breaking almost allWT32_ETH01 codes written for core v1.0.6-.

It's really strange to define a breaking enumarduino_event_id_t inWiFiGeneric.h#L36-L78, compared to the oldsystem_event_id_t, now placed inesp_event_legacy.h#L29-L63

It's better to preserve the old enum order and just adding new itemsto do no harm to pre-2.0.0 codes

To use with core v1.0.6-, just define in your sketch

#defineUSING_CORE_ESP32_CORE_V200_PLUSfalse

Features

  1. Asynchronous HTTPS Request library forESP32, ESP32_S2, ESP32_C3, ESP32_S3,WT32_ETH01 usingLwIP ENC28J60, W5500 or LAN8720
  2. Providing a subset of HTTPS.
  3. Relying onAsyncTCP_SSL library for ESP32
  4. Methods similar in format and usage toXmlHTTPrequest in Javascript.
  5. Coexist withAsyncHTTPRequest library to permit sendingHTTP / HTTPS requests to multiple addresses and receive responses from them

Supports

  1. GET, POST, PUT, PATCH, DELETE and HEAD
  2. Request and response headers
  3. Chunked response
  4. Single String response for short (<~5K) responses (heap permitting).
  5. Optional onData callback.
  6. Optional onReadyStatechange callback.

Principles of operation

This library adds a simple HTTPS layer on top of theAsyncTCP_SSL library tofacilitate REST communication from a Client to a Server. The paradigm is similar to the XMLHttpRequest in Javascript, employing the notion of a ready-state progression through the transaction request.

Synchronization can be accomplished using callbacks on ready-state change, a callback on data receipt, or simply polling for ready-state change. Data retrieval can be incremental as received, or bulk retrieved when the transaction completes provided there is enough heap to buffer the entire response.

The underlying buffering uses a new xbuf class. It handles both character and binary data. Class xbuf uses a chain of small (64 byte) segments that are allocated and added to the tail as data is added and deallocated from the head as data is read, achieving the same result as a dynamic circular buffer limited only by the size of heap. The xbuf implements indexOf and readUntil functions.

For short transactions, buffer space should not be an issue. In fact, it can be more economical than other methods that use larger fixed length buffers. Data is acked when retrieved by the caller, so there is some limited flow control to limit heap usage for larger transfers.

Request and response headers are handled in the typical fashion.

Chunked responses are recognized and handled transparently.

This library is based on, modified from:

  1. Bob Lemaire's asyncHTTPrequest Library
  2. Khoi Hoang's AsyncHTTPSRequest_Generic Library

Currently Supported Boards

1. ESP32 using LwIP ENC28J60, W5500, W6100 or LAN8720

  1. ESP32 (ESP32-DEV, etc.)

2.WT32_ETH01 using ESP32-based boards and LAN8720 Ethernet

3. ESP32S3 using LwIP W5500, W6100 or ENC28J60

  1. ESP32-S3 (ESP32S3_DEV, ESP32_S3_BOX, UM TINYS3, UM PROS3, UM FEATHERS3, etc.)

4. ESP32S2 using LwIP W5500, W6100 or ENC28J60

  1. ESP32-S2 (ESP32S2_DEV, etc.)

5. ESP32C3 using LwIP W5500, W6100 or ENC28J60

  1. ESP32-C3 (ESP32C3_DEV, etc.)

ESP32S3_DEV

ESP32S2_DEV

ESP32C3_DEV


W6100

FULL_DUPLEX, 100Mbps


W5500

FULL_DUPLEX, 100Mbps


ENC28J60

FULL_DUPLEX, 10Mbps


To-be Supported Boards

1. New ESP32 using LwIP W5500, W6100 or ENC28J60



Prerequisites

  1. Arduino IDE 1.8.19+ for Arduino.GitHub release
  2. ESP32 Core 2.0.6+ for ESP32-based boards. [Latest stable releaseRelease Version
  3. AsyncTCP_SSL v1.3.1+ for ESP32.GitHub release
  4. WebServer_WT32_ETH01 v1.5.1+ for ESP32-based WT32_ETH01 usingeither ESP32 core v2.0.0+ or v1.0.6-.GitHub release
  5. WebServer_ESP32_ENC library v1.5.3+ if necessary to use ESP32 boards usingLwIP ENC28J60 Ethernet. To install, checkarduino-library-badge
  6. WebServer_ESP32_W5500 library v1.5.3+ if necessary to use ESP32 boards usingLwIP W5500 Ethernet. To install, checkarduino-library-badge
  7. WebServer_ESP32_SC_ENC library v1.2.1+ if necessary to useESP32_S2/S3/C3 boards usingLwIP ENC28J60 Ethernet. To install, checkarduino-library-badge
  8. WebServer_ESP32_SC_W5500 library v1.2.1+ if necessary to useESP32_S2/S3/C3 boards usingLwIP W5500 Ethernet. To install, checkarduino-library-badge
  9. WebServer_ESP32_W6100 library v1.5.3+ if necessary to use ESP32 boards usingLwIP W6100 Ethernet. To install, checkarduino-library-badge
  10. WebServer_ESP32_SC_W6100 library v1.2.1+ if necessary to useESP32_S2/S3/C3 boards usingLwIP W6100 Ethernet. To install, checkarduino-library-badge


Installation

Use Arduino Library Manager

The best and easiest way is to useArduino Library Manager. Search forAsyncHTTPSRequest_ESP32_Ethernet, then select / install the latest version. You can also use this linkarduino-library-badge for more detailed instructions.

Manual Install

  1. Navigate toAsyncHTTPSRequest_ESP32_Ethernet page.
  2. Download the latest releaseAsyncHTTPSRequest_ESP32_Ethernet-main.zip.
  3. Extract the zip file toAsyncHTTPSRequest_ESP32_Ethernet-main directory
  4. Copy the wholeAsyncHTTPSRequest_ESP32_Ethernet-main folder to Arduino libraries' directory such as~/Arduino/libraries/.

VS Code & PlatformIO

  1. InstallVS Code
  2. InstallPlatformIO
  3. InstallAsyncHTTPSRequest_ESP32_Ethernet library by usingLibrary Manager. Search for AsyncHTTPSRequest_ESP32_Ethernet inPlatform.io Author's Libraries
  4. Use includedplatformio.ini file from examples to ensure that all dependent libraries will installed automatically. Please visit documentation for the other options and examples atProject Configuration File


Note for Platform IO using ESP32 LittleFS

In Platform IO, to fix the error when usingLittleFS_esp32 v1.0 for ESP32-based boards with ESP32 core v1.0.4- (ESP-IDF v3.2-), uncomment the following line

from

//#define CONFIG_LITTLEFS_FOR_IDF_3_2   /* For old IDF - like in release 1.0.4 */

to

#defineCONFIG_LITTLEFS_FOR_IDF_3_2/* For old IDF - like in release 1.0.4*/

It's advisable to use the latestLittleFS_esp32 v1.0.5+ to avoid the issue.

Thanks toRoshan to report the issue inError esp_littlefs.c 'utime_p'



HOWTO FixMultiple Definitions Linker Error

The current library implementation, usingxyz-Impl.h instead of standardxyz.cpp, possibly creates certainMultiple Definitions Linker error in certain use cases.

You can include this.hpp file

// Can be included as many times as necessary, without `Multiple Definitions` Linker Error#include"AsyncHTTPSRequest_ESP32_Ethernet.hpp"//https://github.com/khoih-prog/AsyncHTTPSRequest_ESP32_Ethernet

in many files. But be sure to use the following.h filein just 1.h,.cpp or.ino file, which mustnot be included in any other file, to avoidMultiple Definitions Linker Error

// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error#include"AsyncHTTPSRequest_ESP32_Ethernet.h"//https://github.com/khoih-prog/AsyncHTTPSRequest_ESP32_Ethernet

Check the newmultiFileProject example for aHOWTO demo.

Have a look at the discussion inDifferent behaviour using the src_cpp or src_h lib #80



HOWTO Use analogRead() with ESP32 running WiFi and/or BlueTooth (BT/BLE)

Please have a look atESP_WiFiManager Issue 39: Not able to read analog port when using the autoconnect example to have more detailed description and solution of the issue.

1. ESP32 has 2 ADCs, named ADC1 and ADC2

2. ESP32 ADCs functions

  • ADC1 controls ADC function for pinsGPIO32-GPIO39
  • ADC2 controls ADC function for pinsGPIO0, 2, 4, 12-15, 25-27

3.. ESP32 WiFi uses ADC2 for WiFi functions

Look in fileadc_common.c

In ADC2, there're two locks used for different cases:

  1. lock shared with app and Wi-Fi:ESP32:When Wi-Fi using the ADC2, we assume it will never stop, so app checks the lock and returns immediately if failed.ESP32S2:The controller's control over the ADC is determined by the arbiter. There is no need to control by lock.

  2. lock shared between tasks:when several tasks sharing the ADC2, we want to guaranteeall the requests will be handled.Since conversions are short (about 31us), app returns the lock very soon,we use a spinlock to stand there waiting to do conversions one by one.

adc2_spinlock should be acquired first, then adc2_wifi_lock or rtc_spinlock.

  • In order to useADC2 for other functions, we have toacquire complicated firmware locks and very difficult to do
  • So, it's not advisable to useADC2 with WiFi/BlueTooth (BT/BLE).
  • UseADC1, and pins GPIO32-GPIO39
  • If somehow it's a must to use those pins serviced byADC2 (GPIO0, 2, 4, 12, 13, 14, 15, 25, 26 and 27), use thefix mentioned at the end ofESP_WiFiManager Issue 39: Not able to read analog port when using the autoconnect example to work with ESP32 WiFi/BlueTooth (BT/BLE).


How to connect W5500, W6100 or ENC28J60 to ESP32_S2/S3/C3

W6100

FULL_DUPLEX, 100Mbps


W5500

FULL_DUPLEX, 100Mbps


ENC28J60

FULL_DUPLEX, 10Mbps


ESP32S3_DEV

You can change theINT pin to another one. Default isGPIO4

// Must connect INT to GPIOxx or not working#defineINT_GPIO4
W5500, W6100 or ENC28J60<--->ESP32_S3
MOSI<--->GPIO11
MISO<--->GPIO13
SCK<--->GPIO12
CS/SS<--->GPIO10
INT<--->GPIO4
RST<--->RST
GND<--->GND
3.3V<--->3.3V

ESP32S2_DEV

You can change theINT pin to another one. Default isGPIO4

// Must connect INT to GPIOxx or not working#defineINT_GPIO4
W5500, W6100 or ENC28J60<--->ESP32_S2
MOSI<--->GPIO35
MISO<--->GPIO37
SCK<--->GPIO36
CS/SS<--->GPIO34
INT<--->GPIO4
RST<--->RST
GND<--->GND
3.3V<--->3.3V

ESP32C3_DEV

You can change theINT pin to another one. Default isGPIO4

// Must connect INT to GPIOxx or not working#defineINT_GPIO10
W5500, W6100 or ENC28J60<--->ESP32_C3
MOSI<--->GPIO6
MISO<--->GPIO5
SCK<--->GPIO4
CS/SS<--->GPIO7
INT<--->GPIO10
RST<--->RST
GND<--->GND
3.3V<--->3.3V


Examples

For WT32_ETH01

  1. AsyncHTTPSRequest_WT32_ETH01

For ESP32_ENC

  1. AsyncHTTPSRequest_ESP32_ENC

For ESP32_W5500

  1. AsyncHTTPSRequest_ESP32_W5500

For ESP32_W6100

  1. AsyncHTTPSRequest_ESP32_W6100

For ESP32_SC_ENC

  1. AsyncHTTPSRequest_ESP32_SC_ENC

For ESP32_SC_W5500

  1. AsyncHTTPSRequest_ESP32_SC_W5500

For ESP32_SC_W6100

  1. AsyncHTTPSRequest_ESP32_SC_W6100

For ESP32

  1. multiFileProject

#if !defined(ESP32)
#error This AsyncHTTPSRequest_ESP32_Ethernet library is currently supporting only ESP32 using LwIP Ethernet
#endif
#defineASYNC_HTTPS_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET"AsyncHTTPSRequest_ESP32_Ethernet v2.7.0"
#defineASYNC_HTTPS_REQUEST_ESP32_ETHERNET_VERSION_MIN2007000
/////////////////////////////////////////////////////////
// Uncomment for certain HTTP site to optimize
//#define NOT_SEND_HEADER_AFTER_CONNECTED true
// Use larger queue size if necessary for large data transfer. Default is 512 bytes if not defined here
//#define ASYNC_QUEUE_LENGTH 512
// Use larger priority if necessary. Default is 10 if not defined here. Must be > 4 or adjusted to 4
//#define CONFIG_ASYNC_TCP_PRIORITY (12)
/////////////////////////////////////////////////////////
// Level from 0-4
#defineASYNC_HTTPS_DEBUG_PORT Serial
#define_ASYNC_TCP_SSL_LOGLEVEL_1
#define_ASYNC_HTTPS_LOGLEVEL_2
#define_ETHERNET_WEBSERVER_LOGLEVEL_1
// 300s = 5 minutes to not flooding
#defineHTTPS_REQUEST_INTERVAL60//300
// 10s
#defineHEARTBEAT_INTERVAL10
// Uncomment to use ESP32 core v1.0.6-
//#define USING_CORE_ESP32_CORE_V200_PLUS false
//////////////////////////////////////////////////////////
// For ESP32-S3
// Optional values to override default settings
//#define ETH_SPI_HOST SPI2_HOST
//#define SPI_CLOCK_MHZ 25
// Must connect INT to GPIOxx or not working
//#define INT_GPIO 4
//#define MISO_GPIO 13
//#define MOSI_GPIO 11
//#define SCK_GPIO 12
//#define CS_GPIO 10
// For ESP32_C3
// Optional values to override default settings
// Don't change unless you know what you're doing
//#define ETH_SPI_HOST SPI2_HOST
//#define SPI_CLOCK_MHZ 25
// Must connect INT to GPIOxx or not working
//#define INT_GPIO 10
//#define MISO_GPIO 5
//#define MOSI_GPIO 6
//#define SCK_GPIO 4
//#define CS_GPIO 7
//////////////////////////////////////////////////////////
#include<WebServer_ESP32_SC_W5500.h>// https://github.com/khoih-prog/WebServer_ESP32_SC_W5500
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
#include<AsyncHTTPSRequest_ESP32_Ethernet.h>// https://github.com/khoih-prog/AsyncHTTPSRequest_ESP32_Ethernet
#include<Ticker.h>
AsyncHTTPSRequest request;
Ticker ticker;
Ticker ticker1;
/////////////////////////////////////////////
// Enter a MAC address and IP address for your controller below.
#defineNUMBER_OF_MAC20
byte mac[][NUMBER_OF_MAC] =
{
{0xDE,0xAD,0xBE,0xEF,0xFE,0x01 },
{0xDE,0xAD,0xBE,0xEF,0xBE,0x02 },
{0xDE,0xAD,0xBE,0xEF,0xFE,0x03 },
{0xDE,0xAD,0xBE,0xEF,0xBE,0x04 },
{0xDE,0xAD,0xBE,0xEF,0xFE,0x05 },
{0xDE,0xAD,0xBE,0xEF,0xBE,0x06 },
{0xDE,0xAD,0xBE,0xEF,0xFE,0x07 },
{0xDE,0xAD,0xBE,0xEF,0xBE,0x08 },
{0xDE,0xAD,0xBE,0xEF,0xFE,0x09 },
{0xDE,0xAD,0xBE,0xEF,0xBE,0x0A },
{0xDE,0xAD,0xBE,0xEF,0xFE,0x0B },
{0xDE,0xAD,0xBE,0xEF,0xBE,0x0C },
{0xDE,0xAD,0xBE,0xEF,0xFE,0x0D },
{0xDE,0xAD,0xBE,0xEF,0xBE,0x0E },
{0xDE,0xAD,0xBE,0xEF,0xFE,0x0F },
{0xDE,0xAD,0xBE,0xEF,0xBE,0x10 },
{0xDE,0xAD,0xBE,0xEF,0xFE,0x11 },
{0xDE,0xAD,0xBE,0xEF,0xBE,0x12 },
{0xDE,0xAD,0xBE,0xEF,0xFE,0x13 },
{0xDE,0xAD,0xBE,0xEF,0xBE,0x14 },
};
// Select the IP address according to your local network
IPAddressmyIP(192,168,2,232);
IPAddressmyGW(192,168,2,1);
IPAddressmySN(255,255,255,0);
// Google DNS Server IP
IPAddressmyDNS(8,8,8,8);
/////////////////////////////////////////////
voidheartBeatPrint()
{
staticint num =1;
if (ESP32_W5500_isConnected())
Serial.print(F("H"));// H means connected
else
Serial.print(F("F"));// F means not connected
if (num ==80)
{
Serial.println();
num =1;
}
elseif (num++ %10 ==0)
{
Serial.print(F(""));
}
}
voidsendRequest()
{
staticbool requestOpenResult;
if (request.readyState() == readyStateUnsent || request.readyState() == readyStateDone)
{
//requestOpenResult = request.open("GET", "https://worldtimeapi.org/api/timezone/Europe/London.txt");
requestOpenResult = request.open("GET","https://worldtimeapi.org/api/timezone/America/Toronto.txt");
if (requestOpenResult)
{
// Only send() if open() returns true, or crash
request.send();
}
else
{
Serial.println(F("Can't send bad request"));
}
}
else
{
Serial.println(F("Can't send request"));
}
}
voidrequestCB(void *optParm, AsyncHTTPSRequest *request,int readyState)
{
(void) optParm;
if (readyState == readyStateDone)
{
AHTTPS_LOGDEBUG0(F("\n**************************************\n"));
AHTTPS_LOGDEBUG1(F("Response Code ="), request->responseHTTPString());
if (request->responseHTTPcode() ==200)
{
Serial.println(F("\n**************************************"));
Serial.println(request->responseText());
Serial.println(F("**************************************"));
}
request->setDebug(false);
}
}
voidsetup()
{
// put your setup code here, to run once:
Serial.begin(115200);
while (!Serial &&millis() <5000);
delay(500);
Serial.print(F("\nStarting AsyncHTTPSRequest_ESP32_SC_W5500 using"));
Serial.print(ARDUINO_BOARD);
Serial.print(F(" with"));
Serial.println(SHIELD_TYPE);
Serial.println(WEBSERVER_ESP32_SC_W5500_VERSION);
Serial.println(ASYNC_TCP_SSL_VERSION);
Serial.println(ASYNC_HTTPS_REQUEST_ESP32_ETHERNET_VERSION);
Serial.setDebugOutput(true);
#if defined(ASYNC_HTTPS_REQUEST_ESP32_ETHERNET_VERSION_MIN)
if (ASYNC_HTTPS_REQUEST_ESP32_ETHERNET_VERSION_INT < ASYNC_HTTPS_REQUEST_ESP32_ETHERNET_VERSION_MIN)
{
Serial.print(F("Warning. Must use this example on Version equal or later than :"));
Serial.println(ASYNC_HTTPS_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET);
}
#endif
AHTTPS_LOGWARN(F("Default SPI pinout:"));
AHTTPS_LOGWARN1(F("SPI_HOST:"), ETH_SPI_HOST);
AHTTPS_LOGWARN1(F("MOSI:"), MOSI_GPIO);
AHTTPS_LOGWARN1(F("MISO:"), MISO_GPIO);
AHTTPS_LOGWARN1(F("SCK:"), SCK_GPIO);
AHTTPS_LOGWARN1(F("CS:"), CS_GPIO);
AHTTPS_LOGWARN1(F("INT:"), INT_GPIO);
AHTTPS_LOGWARN1(F("SPI Clock (MHz):"), SPI_CLOCK_MHZ);
AHTTPS_LOGWARN(F("========================="));
///////////////////////////////////
// To be called before ETH.begin()
ESP32_W5500_onEvent();
// start the ethernet connection and the server:
// Use DHCP dynamic IP and random mac
uint16_t index =millis() % NUMBER_OF_MAC;
//bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ,
// int SPI_HOST, uint8_t *W5500_Mac = W5500_Default_Mac);
//ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST );
ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[index] );
// Static IP, leave without this line to get IP via DHCP
//bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0);
//ETH.config(myIP, myGW, mySN, myDNS);
ESP32_W5500_waitForConnect();
///////////////////////////////////
Serial.print(F("\nHTTP WebClient is @ IP :"));
Serial.println(ETH.localIP());
request.setDebug(false);
request.onReadyStateChange(requestCB);
ticker.attach(HTTPS_REQUEST_INTERVAL, sendRequest);
ticker1.attach(HEARTBEAT_INTERVAL, heartBeatPrint);
// Send first request now
sendRequest();
}
voidloop()
{
}



Debug Terminal Output Samples

1. AsyncHTTPSRequest_ESP32_SC_W5500 using ESP32S3_DEV with ESP32_S3_W5500

Following is the debug terminal when running exampleAsyncHTTPSRequest_ESP32_SC_W5500 onESP32S3_DEV to demonstrate the operation of SSL Async HTTPS request, usingAsyncTCP_SSL Library withLwIP W5500 Ethernet

Starting AsyncHTTPSRequest_ESP32_SC_W5500using ESP32S3_DEV with ESP32_S3_W5500WebServer_ESP32_SC_W5500 v1.2.1for core v2.0.0+AsyncTCP_SSL v1.3.1AsyncHTTPSRequest_ESP32_Ethernet v2.7.0[AHTTPS] Default SPI pinout:[AHTTPS] SPI_HOST:2[AHTTPS] MOSI:11[AHTTPS] MISO:13[AHTTPS] SCK:12[AHTTPS] CS:10[AHTTPS] INT:4[AHTTPS] SPIClock (MHz): 25[AHTTPS] =========================ETH StartedETH ConnectedETH MAC: DE:AD:BE:EF:FE:01, IPv4: 192.168.2.95FULL_DUPLEX, 100MbpsHTTP WebClient is @ IP : 192.168.2.95**************************************abbreviation: ESTclient_ip: aaa.bbb.ccc.ddddatetime: 2023-02-01T14:22:06.740570-05:00day_of_week: 3day_of_year: 32dst: falsedst_from: dst_offset: 0dst_until: raw_offset: -18000timezone: America/Torontounixtime: 1675279326utc_datetime: 2023-02-01T19:22:06.740570+00:00utc_offset: -05:00week_number: 5**************************************

2. AsyncHTTPSRequest_ESP32_SC_ENC using ESP32S3_DEV with ESP32_S3_ENC28J60

Following is the debug terminal when running exampleAsyncHTTPSRequest_ESP32_SC_ENC onESP32S3_DEV to demonstrate the operation of SSL Async HTTPS request, usingAsyncTCP_SSL Library withLwIP ENC28J60 Ethernet

Starting AsyncHTTPSRequest_ESP32_SC_ENCusing ESP32S3_DEV with ESP32_S3_ENC28J60WebServer_ESP32_SC_ENC v1.2.1for core v2.0.0+AsyncTCP_SSL v1.3.1AsyncHTTPSRequest_ESP32_Ethernet v2.7.0[AHTTPS] Default SPI pinout:[AHTTPS] SPI_HOST:1[AHTTPS] MOSI:11[AHTTPS] MISO:13[AHTTPS] SCK:12[AHTTPS] CS:10[AHTTPS] INT:4[AHTTPS] SPIClock (MHz): 8[AHTTPS] =========================ETH StartedETH ConnectedETH MAC: DE:AD:BE:EF:BE:04, IPv4: 192.168.2.105FULL_DUPLEX, 10MbpsHTTP WebClient is @ IP : 192.168.2.105**************************************abbreviation: ESTclient_ip: aaa.bbb.ccc.ddddatetime: 2023-02-01T14:23:04.735327-05:00day_of_week: 3day_of_year: 32dst: falsedst_from: dst_offset: 0dst_until: raw_offset: -18000timezone: America/Torontounixtime: 1675279384utc_datetime: 2023-02-01T19:23:04.735327+00:00utc_offset: -05:00week_number: 5**************************************

3. AsyncHTTPSRequest_ESP32_W5500 using ESP32_DEV with ESP32_W5500

Following is the debug terminal when running exampleAsyncHTTPSRequest_ESP32_W5500 onESP32_DEV to demonstrate the operation of SSL Async HTTPS request, usingAsyncTCP_SSL Library withLwIP W5500 Ethernet

Starting AsyncHTTPSRequest_ESP32_W5500using ESP32_DEV with ESP32_W5500WebServer_ESP32_W5500 v1.5.3for core v2.0.0+AsyncTCP_SSL v1.3.1AsyncHTTPSRequest_ESP32_Ethernet v2.7.0[AHTTPS] Default SPI pinout:[AHTTPS] SPI_HOST:2[AHTTPS] MOSI:11[AHTTPS] MISO:13[AHTTPS] SCK:12[AHTTPS] CS:10[AHTTPS] INT:4[AHTTPS] SPIClock (MHz): 25[AHTTPS] =========================ETH StartedETH ConnectedETH MAC: 0C:B8:15:D8:01:D7, IPv4: 192.168.2.158FULL_DUPLEX, 100MbpsHTTP WebClient is @ IP : 192.168.2.158**************************************abbreviation: ESTclient_ip: aaa.bbb.ccc.ddddatetime: 2023-02-01T14:25:04.735194-05:00day_of_week: 3day_of_year: 32dst: falsedst_from: dst_offset: 0dst_until: raw_offset: -18000timezone: America/Torontounixtime: 1675279504utc_datetime: 2023-02-01T19:25:04.735194+00:00utc_offset: -05:00week_number: 5**************************************

4. AsyncHTTPSRequest_ESP32_ENC using ESP32_DEV with ESP32_ENC28J60

Following is the debug terminal when running exampleAsyncHTTPSRequest_ESP32_ENC onESP32_DEV to demonstrate the operation of SSL Async HTTPS request, usingAsyncTCP_SSL Library, withLwIP ENC28J60 Ethernet

Starting AsyncHTTPSRequest_ESP32_ENCusing ESP32_DEV with ESP32_ENC28J60WebServer_ESP32_ENC v1.5.3for core v2.0.0+AsyncTCP_SSL v1.3.1AsyncHTTPSRequest_ESP32_Ethernet v2.7.0[AHTTPS] Default SPI pinout:[AHTTPS] SPI_HOST:1[AHTTPS] MOSI:11[AHTTPS] MISO:13[AHTTPS] SCK:12[AHTTPS] CS:10[AHTTPS] INT:4[AHTTPS] SPIClock (MHz): 8[AHTTPS] =========================ETH StartedETH ConnectedETH MAC: 0C:B8:15:D8:01:D7, IPv4: 192.168.2.158FULL_DUPLEX, 10MbpsHTTP WebClient is @ IP : 192.168.2.158**************************************abbreviation: ESTclient_ip: aaa.bbb.ccc.ddddatetime: 2023-02-01T14:26:04.735728-05:00day_of_week: 3day_of_year: 32dst: falsedst_from: dst_offset: 0dst_until: raw_offset: -18000timezone: America/Torontounixtime: 1675279564utc_datetime: 2023-02-01T19:26:04.735728+00:00utc_offset: -05:00week_number: 5**************************************

5. AsyncHTTPSRequest_ESP32_SC_W5500 using ESP32C3_DEV with ESP32_C3_W5500

Following is the debug terminal when running exampleAsyncHTTPSRequest_ESP32_SC_W5500 onESP32C3_DEV to demonstrate the operation of SSL Async HTTPS request, usingAsyncTCP_SSL Library, withLwIP W5500 Ethernet

Starting AsyncHTTPSRequest_ESP32_SC_W5500using ESP32C3_DEV with ESP32_C3_W5500WebServer_ESP32_SC_W5500 v1.2.1for core v2.0.0+AsyncTCP_SSL v1.3.1AsyncHTTPSRequest_ESP32_Ethernet v2.7.0[AHTTPS] Default SPI pinout:[AHTTPS] SPI_HOST:1[AHTTPS] MOSI:6[AHTTPS] MISO:5[AHTTPS] SCK:4[AHTTPS] CS:7[AHTTPS] INT:10[AHTTPS] SPIClock (MHz): 25[AHTTPS] =========================Using built-in mac_eth = 7C:DF:A1:BC:BC:53ETH StartedETH ConnectedETH MAC: 7C:DF:A1:BC:BC:53, IPv4: 192.168.2.135FULL_DUPLEX, 100MbpsHTTP WebClient is @ IP : 192.168.2.135**************************************abbreviation: ESTclient_ip: aaa.bbb.ccc.ddddatetime: 2023-02-01T14:27:04.739237-05:00day_of_week: 3day_of_year: 32dst: falsedst_from: dst_offset: 0dst_until: raw_offset: -18000timezone: America/Torontounixtime: 1675279624utc_datetime: 2023-02-01T19:27:04.739237+00:00utc_offset: -05:00week_number: 5**************************************HHHHHH**************************************abbreviation: ESTclient_ip: aaa.bbb.ccc.ddddatetime: 2023-02-01T14:28:04.735068-05:00day_of_week: 3day_of_year: 32dst: falsedst_from: dst_offset: 0dst_until: raw_offset: -18000timezone: America/Torontounixtime: 1675279684utc_datetime: 2023-02-01T19:28:04.735068+00:00utc_offset: -05:00week_number: 5**************************************

6. AsyncHTTPSRequest_ESP32_SC_ENC using ESP32C3_DEV with ESP32_C3_ENC28J60

Following is the debug terminal when running exampleAsyncHTTPSRequest_ESP32_SC_ENC onESP32C3_DEV to demonstrate the operation of SSL Async HTTPS request, usingAsyncTCP_SSL Library, withLwIP ENC28J60 Ethernet

Starting AsyncHTTPSRequest_ESP32_SC_ENCusing ESP32C3_DEV with ESP32_C3_ENC28J60WebServer_ESP32_SC_ENC v1.2.1for core v2.0.0+AsyncTCP_SSL v1.3.1AsyncHTTPSRequest_ESP32_Ethernet v2.7.0[AHTTPS] Default SPI pinout:[AHTTPS] SPI_HOST:1[AHTTPS] MOSI:6[AHTTPS] MISO:5[AHTTPS] SCK:4[AHTTPS] CS:7[AHTTPS] INT:10[AHTTPS] SPIClock (MHz): 8[AHTTPS] =========================Using built-in mac_eth = 7C:DF:A1:DA:66:87ETH StartedETH ConnectedETH MAC: 7C:DF:A1:DA:66:87, IPv4: 192.168.2.136FULL_DUPLEX, 10MbpsHTTP WebClient is @ IP : 192.168.2.136**************************************abbreviation: ESTclient_ip: aaa.bbb.ccc.ddddatetime: 2023-02-01T14:29:06.367282-05:00day_of_week: 3day_of_year: 32dst: falsedst_from: dst_offset: 0dst_until: raw_offset: -18000timezone: America/Torontounixtime: 1675279746utc_datetime: 2023-02-01T19:29:06.367282+00:00utc_offset: -05:00week_number: 5**************************************

7. AsyncHTTPSRequest_ESP32_SC_W5500 using ESP32S2_DEV with ESP32_S2_W5500

Following is the debug terminal when running exampleAsyncHTTPSRequest_ESP32_SC_W5500 onESP32S2_DEV to demonstrate the operation of SSL Async HTTPS request, usingAsyncTCP_SSL Library, withLwIP W5500 Ethernet

Starting AsyncHTTPSRequest_ESP32_SC_W5500using ESP32S2_DEV with ESP32_S2_W5500WebServer_ESP32_SC_W5500 v1.2.1for core v2.0.0+AsyncTCP_SSL v1.3.1AsyncHTTPSRequest_ESP32_Ethernet v2.7.0[AHTTPS] Default SPI pinout:[AHTTPS] SPI_HOST:2[AHTTPS] MOSI:35[AHTTPS] MISO:37[AHTTPS] SCK:36[AHTTPS] CS:34[AHTTPS] INT:4[AHTTPS] SPIClock (MHz): 25[AHTTPS] =========================Using built-in mac_eth = 7E:DF:A1:08:32:C9ETH StartedETH ConnectedETH MAC: 7E:DF:A1:08:32:C9, IPv4: 192.168.2.133FULL_DUPLEX, 100MbpsHTTP WebClient is @ IP : 192.168.2.133**************************************abbreviation: ESTclient_ip: aaa.bbb.ccc.ddddatetime: 2023-02-01T14:31:00.753296-05:00day_of_week: 3day_of_year: 32dst: falsedst_from: dst_offset: 0dst_until: raw_offset: -18000timezone: America/Torontounixtime: 1675279860utc_datetime: 2023-02-01T19:31:00.753296+00:00utc_offset: -05:00week_number: 5**************************************

8. AsyncHTTPSRequest_ESP32_SC_W6100 using ESP32S3_DEV with ESP32_S3_W6100

Following is the debug terminal when running exampleAsyncHTTPSRequest_ESP32_SC_W6100 onESP32S3_DEV to demonstrate the operation of SSL Async HTTPS request, usingAsyncTCP_SSL Library, withLwIP W6100 Ethernet

Starting AsyncHTTPSRequest_ESP32_SC_W6100using ESP32S3_DEV with ESP32_S3_W6100WebServer_ESP32_SC_W6100 v1.2.1for core v2.0.0+AsyncTCP_SSL v1.3.1AsyncHTTPSRequest_ESP32_Ethernet v2.7.0[AHTTPS] Default SPI pinout:[AHTTPS] SPI_HOST:2[AHTTPS] MOSI:11[AHTTPS] MISO:13[AHTTPS] SCK:12[AHTTPS] CS:10[AHTTPS] INT:4[AHTTPS] SPIClock (MHz): 25[AHTTPS] =========================ETH StartedETH ConnectedETH MAC: FE:ED:DE:AD:BE:EF, IPv4: 192.168.2.92FULL_DUPLEX, 100MbpsHTTP WebClient is @ IP : 192.168.2.92**************************************abbreviation: ESTclient_ip: aaa.bbb.ccc.ddddatetime: 2023-02-01T14:32:00.755448-05:00day_of_week: 3day_of_year: 32dst: falsedst_from: dst_offset: 0dst_until: raw_offset: -18000timezone: America/Torontounixtime: 1675279920utc_datetime: 2023-02-01T19:32:00.755448+00:00utc_offset: -05:00week_number: 5**************************************HHHHHH**************************************abbreviation: ESTclient_ip: aaa.bbb.ccc.ddddatetime: 2023-02-01T14:33:00.754918-05:00day_of_week: 3day_of_year: 32dst: falsedst_from: dst_offset: 0dst_until: raw_offset: -18000timezone: America/Torontounixtime: 1675279980utc_datetime: 2023-02-01T19:33:00.754918+00:00utc_offset: -05:00week_number: 5**************************************

9. AsyncHTTPSRequest_ESP32_W6100 using ESP32_DEV with ESP32_W6100

Following is the debug terminal when running exampleAsyncHTTPSRequest_ESP32_W6100 onESP32_DEV to demonstrate the operation of SSL Async HTTPS request, usingAsyncTCP_SSL Library, withLwIP W6100 Ethernet

Starting AsyncHTTPSRequest_ESP32_W6100using ESP32_DEV with ESP32_W6100WebServer_ESP32_W6100 v1.5.3for core v2.0.0+AsyncTCP_SSL v1.3.1AsyncHTTPSRequest_ESP32_Ethernet v2.7.0[AHTTPS] Default SPI pinout:[AHTTPS] SPI_HOST:2[AHTTPS] MOSI:23[AHTTPS] MISO:19[AHTTPS] SCK:18[AHTTPS] CS:5[AHTTPS] INT:4[AHTTPS] SPIClock (MHz): 25[AHTTPS] =========================ETH StartedETH ConnectedETH MAC: 0C:B8:15:D8:01:D7, IPv4: 192.168.2.158FULL_DUPLEX, 100MbpsHTTP WebClient is @ IP : 192.168.2.158**************************************abbreviation: ESTclient_ip: aaa.bbb.ccc.ddddatetime: 2023-02-01T14:35:00.755933-05:00day_of_week: 3day_of_year: 32dst: falsedst_from: dst_offset: 0dst_until: raw_offset: -18000timezone: America/Torontounixtime: 1675280100utc_datetime: 2023-02-01T19:35:00.755933+00:00utc_offset: -05:00week_number: 5**************************************


Debug

Debug is enabled by default on Serial.

You can also change the debugging level from 0 to 4

#defineASYNC_HTTPS_DEBUG_PORT          Serial// Use from 0 to 4. Higher number, more debugging messages and memory usage.#define_ASYNC_TCP_SSL_LOGLEVEL_1#define_ASYNC_HTTPS_LOGLEVEL_2

Troubleshooting

If you get compilation errors, more often than not, you may need to install a newer version of theESP32 core for Arduino.

Sometimes, the library will only work if you update theESP32 core to the latest version because I am using newly added functions.


Issues

Submit issues to:AsyncHTTPSRequest_ESP32_Ethernet issues



TO DO

  1. Fix bug. Add enhancement
  2. Add support to moreLwIP Ethernet shields

DONE

  1. Initially add support toESP32/S2/S3/C3 boards usingLwIP W5500 / ENC28J60 / LAN8720 Ethernet
  2. Sync withAsyncHTTPSRequest_Generic v2.4.0
  3. Useallman astyle and addutils. Restyle the library
  4. Add support toESP32S2/C3 boards usingLwIP W5500 or ENC28J60 Ethernet
  5. Add support toESP32 andESP32S2/S3/C3 boards usingLwIP W6100 Ethernet
  6. Fix wrongreqStates bug. CheckCallback behavior buggy #19
  7. Fix_parseURL() bug. CheckBug with _parseURL() #21
  8. ImproveREADME.md so that links can be used in other sites, such asPIO


Contributions and Thanks

This library is based on, modified, bug-fixed and improved from:

  1. Bob Lemaire'sasyncHTTPrequest Library to use the betterasynchronous features of the following Async SSL TCP Libraries : (AsyncTCP_SSL ).
boblemaire
⭐️ Bob Lemaire


Contributing

If you want to contribute to this project:

  • Report bugs and errors
  • Ask for enhancements
  • Create issues and pull requests
  • Tell other people about this library

License and credits

  • The library is licensed underGPLv3

Copyright

Copyright (C) <2018> <Bob Lemaire, IoTaWatt, Inc.>

Copyright (C) 2022- Khoi Hoang

About

Simple Async HTTPS Request library, supporting GET, POST, PUT, PATCH, DELETE and HEAD, on top of AsyncTCP_SSL library for ESP32/S2/S3/C3, WT32_ETH01 (ESP32 + LAN8720), ESP32 using LwIP ENC28J60, W5500, W6100 or LAN8720

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp