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

Don't return true with WiFiClientSecureBearSSL::connected() when really disconnected (#8330)

* Don't return `true` with WiFiClientSecureBearSSL::connected() when disconnected

Apply the same condition as with normal WiFiClient - we are not connected
when it's not possible to both write and read.

Implement separate methods for actual connection status and the internal
ssl engine status and update methods that were previously using available()
for this purpose

Update examples to check available() when the intent is to only read the
data and not interact with the client in any other way. Also, use connect()
as a way to notify errors, no need to check things twice
This commit is contained in:
Max Prokhorov
2022-12-16 14:12:58 +03:00
committed by GitHub
parent 4a0b66b017
commit 9dce0764af
7 changed files with 59 additions and 31 deletions

View File

@ -77,7 +77,7 @@ void setup() {
client.print(String("GET ") + url + " HTTP/1.1\r\n" + "Host: " + github_host + "\r\n" + "User-Agent: BuildFailureDetectorESP8266\r\n" + "Connection: close\r\n\r\n");
Serial.println("Request sent");
while (client.connected()) {
while (client.available()) {
String line = client.readStringUntil('\n');
if (line == "\r") {
Serial.println("Headers received");