esp_http_client_close(client) returns FAIL

kubera
Posts: 23
Joined: Wed May 20, 2020 10:21 am

esp_http_client_close(client) returns FAIL

Postby kubera » Thu Dec 31, 2020 7:44 am

Hi,
I was trying to implement file uploading using the native method. I am able to upload the files without any problem but after the upload when I am trying to close the connection, it always returns FAIL.

Code: Select all

    err = esp_http_client_close(client);
    if (err != ESP_OK)
    {
        ESP_LOGE(TAG, "Failed to close HTTP connection: %s", esp_err_to_name(err));
        esp_http_client_cleanup(client);
    }


Can anybody point me out why is it happening so?

boarchuz
Posts: 606
Joined: Tue Aug 21, 2018 5:28 am

Re: esp_http_client_close(client) returns FAIL

Postby boarchuz » Thu Dec 31, 2020 10:39 am

The server may have already closed the connection after completing the response. You can disregard the return value of esp_http_client_close for your purposes here - either it closes and returns OK, or it's already closed and you get some other code.

Code for the full request would be useful if I'm off the mark.

Who is online

Users browsing this forum: No registered users and 315 guests