ESP32 https request

User avatar
lukfud
Posts: 2480
Joined: Thu Nov 23, 2017 11:33 pm
Location: Warszawa
Has thanked: 13 times
Been thanked: 11 times

Post

Co może być nie tak, że łączy przy pierwszym uruchomieniu, a potem już nie chce.. ?

Code: Select all

podlewa.cz connecting
[  2693][V][ssl_client.cpp:61] start_ssl_client(): Free internal heap before TLS 234792
[  2693][V][ssl_client.cpp:67] start_ssl_client(): Starting socket
[  2730][V][ssl_client.cpp:143] start_ssl_client(): Seeding the random number generator
[  2732][V][ssl_client.cpp:152] start_ssl_client(): Setting up the SSL/TLS structure...
[  2735][I][ssl_client.cpp:173] start_ssl_client(): WARNING: Skipping SSL Verification. INSECURE!
[  2743][V][ssl_client.cpp:244] start_ssl_client(): Setting hostname for TLS session...
[  2751][V][ssl_client.cpp:259] start_ssl_client(): Performing the SSL/TLS handshake...
[  3537][V][ssl_client.cpp:280] start_ssl_client(): Verifying peer X.509 certificate...
[  3538][V][ssl_client.cpp:288] start_ssl_client(): Certificate verified.
[  3541][V][ssl_client.cpp:303] start_ssl_client(): Free internal heap after TLS 195436
Succesful connect
Query: GET /status/mp8aEreqxi2s3iiiiiiiiiiagFnpBiii/
[  3560][V][ssl_client.cpp:351] send_ssl_data(): Writing HTTP request with 54 bytes...
[  3565][V][ssl_client.cpp:351] send_ssl_data(): Writing HTTP request with 2 bytes...
[  3572][V][ssl_client.cpp:351] send_ssl_data(): Writing HTTP request with 16 bytes...
[  3579][V][ssl_client.cpp:351] send_ssl_data(): Writing HTTP request with 2 bytes...
[  3587][V][ssl_client.cpp:351] send_ssl_data(): Writing HTTP request with 17 bytes...
[  3594][V][ssl_client.cpp:351] send_ssl_data(): Writing HTTP request with 2 bytes...
[  3602][V][ssl_client.cpp:351] send_ssl_data(): Writing HTTP request with 2 bytes...
Activity timeout set to 30 s
Current local time: 2022-4-23 21:59:37
Received local time from server: 2022-4-23 21:59:46
Reading data from podlewa.cz: 172
[  3648][V][ssl_client.cpp:311] stop_ssl_socket(): Cleaning SSL connection.
sprinkler status: 1
[  4646][V][ssl_client.cpp:311] stop_ssl_socket(): Cleaning SSL connection.
podlewa.cz fetch completed
[  4648][V][ssl_client.cpp:311] stop_ssl_socket(): Cleaning SSL connection.
podlewa.cz connecting
[122694][V][ssl_client.cpp:61] start_ssl_client(): Free internal heap before TLS 237728
[122694][V][ssl_client.cpp:67] start_ssl_client(): Starting socket
[122722][V][ssl_client.cpp:143] start_ssl_client(): Seeding the random number generator
[122723][V][ssl_client.cpp:152] start_ssl_client(): Setting up the SSL/TLS structure...
[122726][I][ssl_client.cpp:173] start_ssl_client(): WARNING: Skipping SSL Verification. INSECURE!
[122735][V][ssl_client.cpp:244] start_ssl_client(): Setting hostname for TLS session...
[122743][V][ssl_client.cpp:259] start_ssl_client(): Performing the SSL/TLS handshake...
[122755][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -1
[122758][V][ssl_client.cpp:311] stop_ssl_socket(): Cleaning SSL connection.
Failed to connect to podlewa.cz api, return code: 0
podlewa.cz connecting
[127695][V][ssl_client.cpp:61] start_ssl_client(): Free internal heap before TLS 237728
[127695][V][ssl_client.cpp:67] start_ssl_client(): Starting socket
[127718][V][ssl_client.cpp:143] start_ssl_client(): Seeding the random number generator
[127720][V][ssl_client.cpp:152] start_ssl_client(): Setting up the SSL/TLS structure...
[127722][I][ssl_client.cpp:173] start_ssl_client(): WARNING: Skipping SSL Verification. INSECURE!
[127731][V][ssl_client.cpp:244] start_ssl_client(): Setting hostname for TLS session...
[127739][V][ssl_client.cpp:259] start_ssl_client(): Performing the SSL/TLS handshake...
[127751][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -1
[127754][V][ssl_client.cpp:311] stop_ssl_socket(): Cleaning SSL connection.
Failed to connect to podlewa.cz api, return code: 0
https://www.facebook.com/groups/supladiy
https://www.facebook.com/groups/suplazamel
https://www.facebook.com/groups/suplaauraton
https://smartnerzeczy.pl
User avatar
lukfud
Posts: 2480
Joined: Thu Nov 23, 2017 11:33 pm
Location: Warszawa
Has thanked: 13 times
Been thanked: 11 times

Post

Z pomocą Krzysztofa udało się znaleźć i "załatać" problem.
Winnym jest błąd w metodzie

Code: Select all

client.stop();
który zeruje handshake_timeout (domyślnie 120s).
Problem dotyczy wersji płytek 2.0.2 i ma być poprawiony w kolejnym wydaniu.
Łatą jest wywoływanie metody

Code: Select all

client.setHandshakeTimeout(120);
przed każdym połączeniem.
https://github.com/espressif/arduino-esp32/issues/6077
https://www.facebook.com/groups/supladiy
https://www.facebook.com/groups/suplazamel
https://www.facebook.com/groups/suplaauraton
https://smartnerzeczy.pl

Return to “Arduino IDE”