fix(esp_http_client): Fix OTA failure with partial download enabled

This commit fixes an issue encountered during OTA when partial download
is enabled using an AWS signed URL restricted to GET requests.
It also adds an API to retrieve the OTA image size from the Content-Range header.
This commit is contained in:
nilesh.kale
2025-05-20 11:05:42 +05:30
parent 3e46a73964
commit caf828dfaf
5 changed files with 78 additions and 5 deletions

View File

@@ -232,6 +232,7 @@ typedef struct {
typedef enum {
/* 2xx - Success */
HttpStatus_Ok = 200,
HttpStatus_PartialContent = 206,
/* 3xx - Redirection */
HttpStatus_MultipleChoices = 300,
@@ -642,6 +643,19 @@ int esp_http_client_get_status_code(esp_http_client_handle_t client);
*/
int64_t esp_http_client_get_content_length(esp_http_client_handle_t client);
/**
* @brief Get http response content range (from header Content-Range)
* The returned value is valid only if this function is invoked after
* a successful call to `esp_http_client_perform`.
* Content-Range is set to -1 if parsing fails or if the Content-Range header is not present.
*
* @param[in] client The esp_http_client handle
*
* @return
* - Content-Range value as bytes
*/
int64_t esp_http_client_get_content_range(esp_http_client_handle_t client);
/**
* @brief Close http connection, still kept all http request resources
*