mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-13 13:01:55 +03:00
Bugfix/esp8266 http client (#5250)
* Removed _client->stop() from destructor; some minor changes * Changed BasicHttpsClient.ino to allocate BearSSL::WiFiClientSecure object on the heap in stead of stack * Removed unnecessary code * Correcting bad fix for #5216 * Minor formatting to pass Travis tests * Changed client * to std::unique_ptr<> client * Updated example
This commit is contained in:
@ -41,7 +41,7 @@ void loop() {
|
||||
// wait for WiFi connection
|
||||
if ((WiFiMulti.run() == WL_CONNECTED)) {
|
||||
|
||||
BearSSL::WiFiClientSecure *client = new BearSSL::WiFiClientSecure;
|
||||
std::unique_ptr<BearSSL::WiFiClientSecure>client(new BearSSL::WiFiClientSecure);
|
||||
|
||||
client->setFingerprint(fingerprint);
|
||||
|
||||
@ -50,7 +50,6 @@ void loop() {
|
||||
Serial.print("[HTTPS] begin...\n");
|
||||
if (https.begin(*client, "https://jigsaw.w3.org/HTTP/connection.html")) { // HTTPS
|
||||
|
||||
|
||||
Serial.print("[HTTPS] GET...\n");
|
||||
// start connection and send HTTP header
|
||||
int httpCode = https.GET();
|
||||
@ -73,9 +72,8 @@ void loop() {
|
||||
} else {
|
||||
Serial.printf("[HTTPS] Unable to connect\n");
|
||||
}
|
||||
|
||||
delete client;
|
||||
}
|
||||
|
||||
Serial.println("Wait 10s before next round...");
|
||||
delay(10000);
|
||||
}
|
||||
|
Reference in New Issue
Block a user