mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-20 00:36:01 -04:00
esp_https_ota: Add a feature to set custom headers to esp_https_ota request
Closes: https://github.com/espressif/esp-idf/issues/3097
This commit is contained in:
parent
7d3618a86c
commit
c4d16e9f79
@ -22,12 +22,14 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef void *esp_https_ota_handle_t;
|
typedef void *esp_https_ota_handle_t;
|
||||||
|
typedef esp_err_t(*http_client_init_cb_t)(esp_http_client_handle_t);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ESP HTTPS OTA configuration
|
* @brief ESP HTTPS OTA configuration
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const esp_http_client_config_t *http_config; /*!< ESP HTTP client configuration */
|
const esp_http_client_config_t *http_config; /*!< ESP HTTP client configuration */
|
||||||
|
http_client_init_cb_t http_client_init_cb; /*!< Callback after ESP HTTP client is initialised */
|
||||||
} esp_https_ota_config_t;
|
} esp_https_ota_config_t;
|
||||||
|
|
||||||
#define ESP_ERR_HTTPS_OTA_BASE (0x9000)
|
#define ESP_ERR_HTTPS_OTA_BASE (0x9000)
|
||||||
|
@ -173,6 +173,14 @@ esp_err_t esp_https_ota_begin(esp_https_ota_config_t *ota_config, esp_https_ota_
|
|||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ota_config->http_client_init_cb) {
|
||||||
|
err = ota_config->http_client_init_cb(https_ota_handle->http_client);
|
||||||
|
if (err != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "http_client_init_cb returned %d", err);
|
||||||
|
goto failure;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err = _http_connect(https_ota_handle->http_client);
|
err = _http_connect(https_ota_handle->http_client);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to establish HTTP connection");
|
ESP_LOGE(TAG, "Failed to establish HTTP connection");
|
||||||
|
Loading…
Reference in New Issue
Block a user