mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 19:54:32 +02:00
advanced_https_ota_example: Demonstrate use of init_complete_callback to set custom headers
This commit is contained in:
@@ -52,6 +52,14 @@ static esp_err_t validate_image_header(esp_app_desc_t *new_app_info)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static esp_err_t _http_client_init_cb(esp_http_client_handle_t http_client)
|
||||||
|
{
|
||||||
|
esp_err_t err = ESP_OK;
|
||||||
|
/* Uncomment to add custom headers to HTTP request */
|
||||||
|
// err = esp_http_client_set_header(http_client, "Custom-Header", "Value");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
void advanced_ota_example_task(void *pvParameter)
|
void advanced_ota_example_task(void *pvParameter)
|
||||||
{
|
{
|
||||||
ESP_LOGI(TAG, "Starting Advanced OTA example");
|
ESP_LOGI(TAG, "Starting Advanced OTA example");
|
||||||
@@ -83,6 +91,7 @@ void advanced_ota_example_task(void *pvParameter)
|
|||||||
|
|
||||||
esp_https_ota_config_t ota_config = {
|
esp_https_ota_config_t ota_config = {
|
||||||
.http_config = &config,
|
.http_config = &config,
|
||||||
|
.http_client_init_cb = _http_client_init_cb, // Register a callback to be invoked after esp_http_client is initialized
|
||||||
};
|
};
|
||||||
|
|
||||||
esp_https_ota_handle_t https_ota_handle = NULL;
|
esp_https_ota_handle_t https_ota_handle = NULL;
|
||||||
|
Reference in New Issue
Block a user