1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

ESP8266httpClient crash-on-destructor bugfix (#5220)

* Removed _client->stop() from destructor; some minor changes

* Changed BasicHttpsClient.ino to allocate BearSSL::WiFiClientSecure object on the heap in stead of stack
This commit is contained in:
Jeroen88
2018-10-12 00:34:25 +02:00
committed by Earle F. Philhower, III
parent 1b1b0a28a8
commit c8497da676
2 changed files with 14 additions and 10 deletions

View File

@ -41,13 +41,14 @@ void loop() {
// wait for WiFi connection
if ((WiFiMulti.run() == WL_CONNECTED)) {
BearSSL::WiFiClientSecure client;
client.setFingerprint(fingerprint);
BearSSL::WiFiClientSecure *client = new BearSSL::WiFiClientSecure;
client->setFingerprint(fingerprint);
HTTPClient https;
Serial.print("[HTTPS] begin...\n");
if (https.begin(client, "https://jigsaw.w3.org/HTTP/connection.html")) { // HTTPS
if (https.begin(*client, "https://jigsaw.w3.org/HTTP/connection.html")) { // HTTPS
Serial.print("[HTTPS] GET...\n");
@ -72,6 +73,8 @@ void loop() {
} else {
Serial.printf("[HTTPS] Unable to connect\n");
}
delete client;
}
delay(10000);