feat: enabled configurable session resumption support in ota examples

This commit added config option to enable session ticket support
while performing ota. This helps in optimizing latency while
downloading ota over multiple HTTP requests.

closes https://github.com/espressif/esp-idf/issues/14783
This commit is contained in:
nilesh.kale
2024-11-06 14:23:04 +05:30
parent e4102c5443
commit ea6e6cfcbd
4 changed files with 12 additions and 2 deletions

View File

@@ -31,9 +31,11 @@ menu "Example Configuration"
config EXAMPLE_ENABLE_PARTIAL_HTTP_DOWNLOAD config EXAMPLE_ENABLE_PARTIAL_HTTP_DOWNLOAD
bool "Enable partial HTTP download" bool "Enable partial HTTP download"
default n default n
select ESP_TLS_CLIENT_SESSION_TICKETS
help help
This enables use of Range header in esp_https_ota component. This enables use of Range header in esp_https_ota component.
Firmware image will be downloaded over multiple HTTP requests. The firmware image will be downloaded over multiple HTTP requests,
with session resumption enabled between them.
config EXAMPLE_HTTP_REQUEST_SIZE config EXAMPLE_HTTP_REQUEST_SIZE
int "HTTP request size" int "HTTP request size"

View File

@@ -129,6 +129,9 @@ void advanced_ota_example_task(void *pvParameter)
.cert_pem = (char *)server_cert_pem_start, .cert_pem = (char *)server_cert_pem_start,
.timeout_ms = CONFIG_EXAMPLE_OTA_RECV_TIMEOUT, .timeout_ms = CONFIG_EXAMPLE_OTA_RECV_TIMEOUT,
.keep_alive_enable = true, .keep_alive_enable = true,
#ifdef CONFIG_EXAMPLE_ENABLE_PARTIAL_HTTP_DOWNLOAD
.save_client_session = true,
#endif
}; };
#ifdef CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL_FROM_STDIN #ifdef CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL_FROM_STDIN

View File

@@ -31,9 +31,11 @@ menu "Example Configuration"
config EXAMPLE_ENABLE_PARTIAL_HTTP_DOWNLOAD config EXAMPLE_ENABLE_PARTIAL_HTTP_DOWNLOAD
bool "Enable partial HTTP download" bool "Enable partial HTTP download"
default n default n
select ESP_TLS_CLIENT_SESSION_TICKETS
help help
This enables use of Range header in esp_https_ota component. This enables use of Range header in esp_https_ota component.
Firmware image will be downloaded over multiple HTTP requests. The firmware image will be downloaded over multiple HTTP requests,
with session resumption enabled between them.
config EXAMPLE_HTTP_REQUEST_SIZE config EXAMPLE_HTTP_REQUEST_SIZE
int "HTTP request size" int "HTTP request size"

View File

@@ -108,6 +108,9 @@ void pre_encrypted_ota_task(void *pvParameter)
.cert_pem = server_cert_pem_start, .cert_pem = server_cert_pem_start,
.timeout_ms = CONFIG_EXAMPLE_OTA_RECV_TIMEOUT, .timeout_ms = CONFIG_EXAMPLE_OTA_RECV_TIMEOUT,
.keep_alive_enable = true, .keep_alive_enable = true,
#ifdef CONFIG_EXAMPLE_ENABLE_PARTIAL_HTTP_DOWNLOAD
.save_client_session = true,
#endif
}; };
esp_decrypt_cfg_t cfg = {}; esp_decrypt_cfg_t cfg = {};
cfg.rsa_priv_key = rsa_private_pem_start; cfg.rsa_priv_key = rsa_private_pem_start;