Can't create Https connection
Posted: Fri Feb 14, 2020 4:03 pm
Hello guys,
I'm new to ESP-IDF and currently trying to write a class in which I can schedule https requests.
As a base I took the wifi/getting-started and protocols/https-request example and merged them into a single class.
However when I try to initiate a new https connection I'm always getting an LoadProhibited Exception with the following stack-trace:
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x400014e8 PS : 0x00060d30 A0 : 0x800faaf2 A1 : 0x3ffc8a20
A2 : 0x00000006 A3 : 0x00000004 A4 : 0x000000ff A5 : 0x0000ff00
A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x01000a01 A9 : 0x00000001
A10 : 0x3f40fc34 A11 : 0x00000000 A12 : 0x00000028 A13 : 0x00000000
A14 : 0x00000001 A15 : 0x00000000 SAR : 0x0000000a EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000004 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffd
ELF file SHA256: 2ece161e79310e5355193ee970340b93b83cef5b4a8d09a7b4fcb685a2f79d82
Backtrace: 0x400014e5:0x3ffc8a20 0x400faaef:0x3ffc8a30 0x400f8f31:0x3ffc8a50 0x400f90c4:0x3ffc8a90 0x400f85d2:0x3ffc8ac0 0x400f8774:0x3ffc8ae0 0x400f88e3:0x3ffc8b10 0x400f89a1:0x3ffc8b40 0x400d66c9:0x3ffc8b80 0x400d6fa6:0x3ffc8c00 0x400d5cec:0x3ffc8c30 0x400926f9:0x3ffc8c50
0x400faaef: mbedtls_ssl_conf_alpn_protocols at /home/manuel/esp-idf/components/mbedtls/mbedtls/library/ssl_tls.c:7575
0x400f8f31: set_client_config at /home/manuel/esp-idf/components/esp-tls/esp_tls_mbedtls.c:395
0x400f90c4: esp_create_mbedtls_handle at /home/manuel/esp-idf/components/esp-tls/esp_tls_mbedtls.c:56
0x400f85d2: create_ssl_handle at /home/manuel/esp-idf/components/esp-tls/esp_tls.c:73
0x400f8774: esp_tls_low_level_conn at /home/manuel/esp-idf/components/esp-tls/esp_tls.c:283
0x400f88e3: esp_tls_conn_new_sync at /home/manuel/esp-idf/components/esp-tls/esp_tls.c:347
0x400f89a1: esp_tls_conn_http_new at /home/manuel/esp-idf/components/esp-tls/esp_tls.c:402
0x400d66c9: network::HttpsRequester::make_request(network::Request*) at /home/manuel/Projects/espify/build/../main/src/network/HttpsRequester.cpp:103
0x400d6fa6: network::HttpsRequester::update() at /home/manuel/Projects/espify/build/../main/src/network/HttpsRequester.cpp:184
0x400d5cec: https_requester_update(void*) at /home/manuel/Projects/espify/build/../main/main.cpp:27 (discriminator 1)
0x400926f9: vPortTaskWrapper at /home/manuel/esp-idf/components/freertos/xtensa/port.c:143
First of all here is the merged class: https://github.com/manuel2258/espify/bl ... uester.cpp
Its Ctor initiates the wifi connection, then waits for the
Event after which it handles the queued requests.
So when making a requests I'm simply connecting to the host just like in the example:
while tls_cfg is a member of the class and defined like this:
The server_root_cert.pem is loaded successfully, as I can print it out.
So I'm not quite sure what I'm doing wrong here. Is the Wifi-Connection not yet established right? Can't the esp_tls_cfg_t be a class member? Am I missing any necessary configs?
Using woflSSL instead of mbedTLS does't work either.
The used version is ESP-IDF v4.1-dev-2239-gc1d0daf36.
If there is any information missing please let me know.
Thanks a lot for your help and time in advance!
LG. Manuel
I'm new to ESP-IDF and currently trying to write a class in which I can schedule https requests.
As a base I took the wifi/getting-started and protocols/https-request example and merged them into a single class.
However when I try to initiate a new https connection I'm always getting an LoadProhibited Exception with the following stack-trace:
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x400014e8 PS : 0x00060d30 A0 : 0x800faaf2 A1 : 0x3ffc8a20
A2 : 0x00000006 A3 : 0x00000004 A4 : 0x000000ff A5 : 0x0000ff00
A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x01000a01 A9 : 0x00000001
A10 : 0x3f40fc34 A11 : 0x00000000 A12 : 0x00000028 A13 : 0x00000000
A14 : 0x00000001 A15 : 0x00000000 SAR : 0x0000000a EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000004 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffd
ELF file SHA256: 2ece161e79310e5355193ee970340b93b83cef5b4a8d09a7b4fcb685a2f79d82
Backtrace: 0x400014e5:0x3ffc8a20 0x400faaef:0x3ffc8a30 0x400f8f31:0x3ffc8a50 0x400f90c4:0x3ffc8a90 0x400f85d2:0x3ffc8ac0 0x400f8774:0x3ffc8ae0 0x400f88e3:0x3ffc8b10 0x400f89a1:0x3ffc8b40 0x400d66c9:0x3ffc8b80 0x400d6fa6:0x3ffc8c00 0x400d5cec:0x3ffc8c30 0x400926f9:0x3ffc8c50
0x400faaef: mbedtls_ssl_conf_alpn_protocols at /home/manuel/esp-idf/components/mbedtls/mbedtls/library/ssl_tls.c:7575
0x400f8f31: set_client_config at /home/manuel/esp-idf/components/esp-tls/esp_tls_mbedtls.c:395
0x400f90c4: esp_create_mbedtls_handle at /home/manuel/esp-idf/components/esp-tls/esp_tls_mbedtls.c:56
0x400f85d2: create_ssl_handle at /home/manuel/esp-idf/components/esp-tls/esp_tls.c:73
0x400f8774: esp_tls_low_level_conn at /home/manuel/esp-idf/components/esp-tls/esp_tls.c:283
0x400f88e3: esp_tls_conn_new_sync at /home/manuel/esp-idf/components/esp-tls/esp_tls.c:347
0x400f89a1: esp_tls_conn_http_new at /home/manuel/esp-idf/components/esp-tls/esp_tls.c:402
0x400d66c9: network::HttpsRequester::make_request(network::Request*) at /home/manuel/Projects/espify/build/../main/src/network/HttpsRequester.cpp:103
0x400d6fa6: network::HttpsRequester::update() at /home/manuel/Projects/espify/build/../main/src/network/HttpsRequester.cpp:184
0x400d5cec: https_requester_update(void*) at /home/manuel/Projects/espify/build/../main/main.cpp:27 (discriminator 1)
0x400926f9: vPortTaskWrapper at /home/manuel/esp-idf/components/freertos/xtensa/port.c:143
First of all here is the merged class: https://github.com/manuel2258/espify/bl ... uester.cpp
Its Ctor initiates the wifi connection, then waits for the
Code: Select all
(event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP)
Event after which it handles the queued requests.
So when making a requests I'm simply connecting to the host just like in the example:
Code: Select all
struct esp_tls *tls = esp_tls_conn_http_new(url_ptr->c_str(), tls_cfg);
Code: Select all
tls_cfg = new esp_tls_cfg_t;
tls_cfg->cacert_buf = server_root_cert_pem_start;
tls_cfg->cacert_bytes = server_root_cert_pem_end - server_root_cert_pem_start;
So I'm not quite sure what I'm doing wrong here. Is the Wifi-Connection not yet established right? Can't the esp_tls_cfg_t be a class member? Am I missing any necessary configs?
Using woflSSL instead of mbedTLS does't work either.
The used version is ESP-IDF v4.1-dev-2239-gc1d0daf36.
If there is any information missing please let me know.
Thanks a lot for your help and time in advance!
LG. Manuel