Skip to content

Commit 18654ce

Browse files
author
Jeroen88
committed
Changed BasicHttpsClient.ino to allocate BearSSL::WiFiClientSecure object on the heap in stead of stack
1 parent 3a10f93 commit 18654ce

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

libraries/ESP8266HTTPClient/examples/BasicHttpsClient/BasicHttpsClient.ino

+6-3
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@ void loop() {
4141
// wait for WiFi connection
4242
if ((WiFiMulti.run() == WL_CONNECTED)) {
4343

44-
BearSSL::WiFiClientSecure client;
45-
client.setFingerprint(fingerprint);
44+
BearSSL::WiFiClientSecure *client = new BearSSL::WiFiClientSecure;
45+
46+
client->setFingerprint(fingerprint);
4647

4748
HTTPClient https;
4849

4950
Serial.print("[HTTPS] begin...\n");
50-
if (https.begin(client, "https://jigsaw.w3.org/HTTP/connection.html")) { // HTTPS
51+
if (https.begin(*client, "https://jigsaw.w3.org/HTTP/connection.html")) { // HTTPS
5152

5253

5354
Serial.print("[HTTPS] GET...\n");
@@ -72,6 +73,8 @@ void loop() {
7273
} else {
7374
Serial.printf("[HTTPS] Unable to connect\n");
7475
}
76+
77+
delete client;
7578
}
7679

7780
delay(10000);

0 commit comments

Comments
 (0)