Skip to content
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

WifClientSecure breaking on ESP8266? #892

Open
mooomooo opened this issue Jul 17, 2024 · 0 comments
Open

WifClientSecure breaking on ESP8266? #892

mooomooo opened this issue Jul 17, 2024 · 0 comments

Comments

@mooomooo
Copy link

MWE: Starting from the example sketch in https://github.com/Links2004/arduinoWebSockets/blob/master/examples/esp8266_pico/WebSocketClientSSL/WebSocketClientSSL.ino, which works fine, I add a new function:

const char* url = "https://www.howsmyssl.com/a/check";

void https() {
    WiFiClientSecure client;
    HTTPClient https;
    client.setInsecure();
    int checkBegin = https.begin(client, url);
    int code = https.GET();
    String payload = https.getString();
    USE_SERIAL.printf("!!!  Begin = %d, code = %d, payload:", checkBegin, code);
    USE_SERIAL.println(payload);
    https.end();
    client.stop();
}

Whenever I call this function before any calls to webSocket.loop(); it successfully connects and prints the payload. However, anytime afterwards, it fails to connect with the debug log:

[HTTP-Client][begin] url: https://www.howsmyssl.com/a/check
[HTTP-Client][begin] host: www.howsmyssl.com port: 443 url: /a/check
[HTTP-Client][sendRequest] type: 'GET' redirCount: 0
[HTTP-Client] failed connect to www.howsmyssl.com:443
[HTTP-Client][returnError] error(-1): connection failed
[HTTP-Client][end] tcp is closed
!!!  Begin = 1, code = -1, payload:
[HTTP-Client][end] tcp is closed

Somehow, the websockets library is preventing any further SSL connections? Notably, this isn't a problem with subsequent http requests using WiFiClient (i.e. not Secure). This issue also does not show up on ESP32 (i.e. it works as expected).

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