Merge branch 'feature/backport_v4.4_add_get_errno_api_for_http_client' into 'release/v4.4'

esp_http_client: add a get HTTP client session errno API for esp_http_client(backport v4.4)

See merge request espressif/esp-idf!16195
This commit is contained in:
Mahavir Jain 2021-11-30 12:23:31 +00:00
commit 376514480d
2 changed files with 20 additions and 0 deletions

View File

@ -905,6 +905,15 @@ esp_err_t esp_http_client_set_url(esp_http_client_handle_t client, const char *u
return ESP_OK; return ESP_OK;
} }
int esp_http_client_get_errno(esp_http_client_handle_t client)
{
if (!client) {
ESP_LOGE(TAG, "Invalid client handle");
return -1;
}
return esp_transport_get_errno(client->transport);
}
esp_err_t esp_http_client_set_method(esp_http_client_handle_t client, esp_http_client_method_t method) esp_err_t esp_http_client_set_method(esp_http_client_handle_t client, esp_http_client_method_t method)
{ {
client->connection_info.method = method; client->connection_info.method = method;

View File

@ -344,6 +344,17 @@ esp_err_t esp_http_client_set_password(esp_http_client_handle_t client, const ch
*/ */
esp_err_t esp_http_client_set_authtype(esp_http_client_handle_t client, esp_http_client_auth_type_t auth_type); esp_err_t esp_http_client_set_authtype(esp_http_client_handle_t client, esp_http_client_auth_type_t auth_type);
/**
* @brief Get HTTP client session errno
*
* @param[in] client The esp_http_client handle
*
* @return
* - (-1) if invalid argument
* - errno
*/
int esp_http_client_get_errno(esp_http_client_handle_t client);
/** /**
* @brief Set http request method * @brief Set http request method
* *