Skip to content

Commit a79724b

Browse files
author
Raoul Rubien
committed
esp_https_ota_begin(): implements handling of HttpStatus_PartialContent-code 206
1 parent 683ddf8 commit a79724b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

components/esp_https_ota/src/esp_https_ota.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,14 @@ static bool process_again(int status_code)
103103
static esp_err_t _http_handle_response_code(esp_https_ota_t *https_ota_handle, int status_code)
104104
{
105105
esp_err_t err = ESP_FAIL;
106-
if (redirection_required(status_code)) {
106+
if (https_ota_handle->binary_file_len > 0
107+
#if CONFIG_ESP_HTTPS_OTA_ENABLE_PARTIAL_DOWNLOAD
108+
&& !https_ota_handle->partial_http_download
109+
#endif
110+
&& status_code != HttpStatus_PartialContent) {
111+
ESP_LOGE(TAG, "Requested range header ignored by server");
112+
return ESP_ERR_HTTP_RANGE_NOT_SATISFIABLE;
113+
} else if (redirection_required(status_code)) {
107114
err = esp_http_client_set_redirection(https_ota_handle->http_client);
108115
if (err != ESP_OK) {
109116
ESP_LOGE(TAG, "URL redirection Failed");

0 commit comments

Comments
 (0)