Commit c7e37549 authored by Jacob Priddy's avatar Jacob Priddy 👌

fix attempt 2

parent 2fc2f977
Pipeline #12692 passed with stages
in 1 minute and 12 seconds
......@@ -194,18 +194,24 @@ int door_http_post(
}
current_request_callbacks = callbacks;
esp_http_client_set_url(handle, path);
esp_http_client_set_method(handle, HTTP_METHOD_POST);
esp_http_client_set_post_field(client, data, strlen(data));
esp_err_t err = esp_http_client_perform(handle);
if (err != ESP_OK)
{
ESP_LOGE(TAG, "Error perform http request %s", esp_err_to_name(err));
return DOOR_HTTP_ERR_FAIL;
for (int tries = 0; tries < 5; ++tries) {
esp_http_client_set_url(handle, path);
esp_http_client_set_method(handle, HTTP_METHOD_POST);
esp_http_client_set_post_field(client, data, strlen(data));
esp_err_t err = esp_http_client_perform(handle);
if (err == ESP_OK)
{
int status_code = esp_http_client_get_status_code(handle);
ESP_LOGI(TAG, "Status code from POST call: %d", status_code);
return status_code;
}
ESP_LOGE(TAG, "Error perform http request %s. Retrying...", esp_err_to_name(err));
esp_http_client_close(handle);
}
int status_code = esp_http_client_get_status_code(handle);
ESP_LOGI(TAG, "Status code from POST call: %d", status_code);
return status_code;
return DOOR_HTTP_ERR_FAIL;
}
static esp_err_t door_http_ota_update_validate_image_header(esp_app_desc_t* new_app_info)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment