Skip to content

WiFiClientSecureCtx: hardcoded timeout #8203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
5 tasks done
vlastahajek opened this issue Jul 9, 2021 · 0 comments
Open
5 tasks done

WiFiClientSecureCtx: hardcoded timeout #8203

vlastahajek opened this issue Jul 9, 2021 · 0 comments

Comments

@vlastahajek
Copy link
Contributor

Problem Description

WiFiClientSecure doesn't propagate timeout to WiFiClientSecureCtx.
WiFiClientSecureCtx has hardcoded timeout 15000ms, which is changed to 5000ms after successfull secure connection.

When using HTTPClient, its timeout is progated to an underlaying WifiClient instance in the sendRequest.

I understand that secured connecting requires higher timeouts. I suggest introducing a configurable connection timeout and distinguish it from the current used read timeout.

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • I have filled out all fields below.

Platform

  • Hardware: [ESP-12F]
  • Core Version: [2021-07-09]
  • Development Env: [Arduino IDE]
  • Operating System: [Windows]

Settings in IDE

  • Module: [D1 Mini Clone]
  • Flash Mode: [DOUT]
  • Flash Size: [4MB]
  • lwip Variant: [v2 Lower Memory]
  • Reset Method: [N/A]
  • Flash Frequency: [40Mhz]
  • CPU Frequency: [80Mhz]
  • Upload Using: [SERIAL]
  • Upload Speed: [921600]

MCVE Sketch

#include <Arduino.h>

#include <ESP8266WiFi.h>

#include <ESP8266HTTPClient.h>

void setup() {

  Serial.begin(74880);

  Serial.println();
  Serial.println("WifiClientSecure timeout test");

  WiFi.mode(WIFI_STA);
  //WiFi.begin("SSID", "PASSWORD");
  WiFi.begin("Bonitoo-ng", "change1t");
}

void loop() {
  // wait for WiFi connection
  if (WiFi.isConnected()) {
    BearSSL::WiFiClientSecure client;
    client.setTimeout(4000);
    uint32_t start = millis();
    int r = client.connect("www.google.com",440);
    Serial.printf("Connection took: %lums\n", millis()-start);
    if(r) {
      client.stop();
    }
  }

  Serial.println("Wait 10s before the next round...");
  delay(10000);
}

Debug Messages

WifiClientSecure timeout test
Wait 10s before the next round...
Connection took: 15597ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant