HTTPS cancel download of large file
Posted: Fri Feb 24, 2023 4:55 pm
We are downloading a large file using HTTPS and calling "esp_http_client_perform()" in blocked mode.
Our App requires possibility for canceling the download, we have implemented a function that calls: esp_http_client_close(client)
The call is made from another task than the download task.
This works most of the times, but sometimes we see an error, the backtrace is below.
What is correct procedure to cancel a download ?
0x40155cf7: ssl_get_next_record at C:/Espressif/frameworks/esp-idf-v5.0/components/mbedtls/mbedtls/library/ssl_msg.c:4617
0x40155d82: mbedtls_ssl_read_record at C:/Espressif/frameworks/esp-idf-v5.0/components/mbedtls/mbedtls/library/ssl_msg.c:3869
0x40155eb2: mbedtls_ssl_read at C:/Espressif/frameworks/esp-idf-v5.0/components/mbedtls/mbedtls/library/ssl_msg.c:5467
0x40151141: esp_mbedtls_read at C:/Espressif/frameworks/esp-idf-v5.0/components/esp-tls/esp_tls_mbedtls.c:222
0x401afb9e: esp_tls_conn_read at C:/Espressif/frameworks/esp-idf-v5.0/components/esp-tls/esp_tls.c:98
0x40194310: ssl_read at C:/Espressif/frameworks/esp-idf-v5.0/components/tcp_transport/transport_ssl.c:253
0x401b1829: esp_transport_read at C:/Espressif/frameworks/esp-idf-v5.0/components/tcp_transport/transport.c:140
0x40151d01: esp_http_client_get_data at C:/Espressif/frameworks/esp-idf-v5.0/components/esp_http_client/esp_http_client.c:1011
0x401531eb: esp_http_client_perform at C:/Espressif/frameworks/esp-idf-v5.0/components/esp_http_client/esp_http_client.c:1188
.......
Our App requires possibility for canceling the download, we have implemented a function that calls: esp_http_client_close(client)
The call is made from another task than the download task.
This works most of the times, but sometimes we see an error, the backtrace is below.
What is correct procedure to cancel a download ?
0x40155cf7: ssl_get_next_record at C:/Espressif/frameworks/esp-idf-v5.0/components/mbedtls/mbedtls/library/ssl_msg.c:4617
0x40155d82: mbedtls_ssl_read_record at C:/Espressif/frameworks/esp-idf-v5.0/components/mbedtls/mbedtls/library/ssl_msg.c:3869
0x40155eb2: mbedtls_ssl_read at C:/Espressif/frameworks/esp-idf-v5.0/components/mbedtls/mbedtls/library/ssl_msg.c:5467
0x40151141: esp_mbedtls_read at C:/Espressif/frameworks/esp-idf-v5.0/components/esp-tls/esp_tls_mbedtls.c:222
0x401afb9e: esp_tls_conn_read at C:/Espressif/frameworks/esp-idf-v5.0/components/esp-tls/esp_tls.c:98
0x40194310: ssl_read at C:/Espressif/frameworks/esp-idf-v5.0/components/tcp_transport/transport_ssl.c:253
0x401b1829: esp_transport_read at C:/Espressif/frameworks/esp-idf-v5.0/components/tcp_transport/transport.c:140
0x40151d01: esp_http_client_get_data at C:/Espressif/frameworks/esp-idf-v5.0/components/esp_http_client/esp_http_client.c:1011
0x401531eb: esp_http_client_perform at C:/Espressif/frameworks/esp-idf-v5.0/components/esp_http_client/esp_http_client.c:1188
.......