mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-07 14:44:32 +02:00
Merge branch 'contrib/github_pr_10715' into 'master'
Add user_data accessor and mutator to esp_http_client (GitHub PR) Closes IDFGH-9337 and IDFGH-9221 See merge request espressif/esp-idf!22751
This commit is contained in:
@@ -428,6 +428,28 @@ esp_err_t esp_http_client_set_authtype(esp_http_client_handle_t client, esp_http
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
esp_err_t esp_http_client_get_user_data(esp_http_client_handle_t client, void **data)
|
||||||
|
{
|
||||||
|
if (NULL == client || NULL == data) {
|
||||||
|
ESP_LOGE(TAG, "client or data must not be NULL");
|
||||||
|
return ESP_ERR_INVALID_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
*data = client->user_data;
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t esp_http_client_set_user_data(esp_http_client_handle_t client, void *data)
|
||||||
|
{
|
||||||
|
if (NULL == client) {
|
||||||
|
ESP_LOGE(TAG, "client must not be NULL");
|
||||||
|
return ESP_ERR_INVALID_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
client->user_data = data;
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static esp_err_t _set_config(esp_http_client_handle_t client, const esp_http_client_config_t *config)
|
static esp_err_t _set_config(esp_http_client_handle_t client, const esp_http_client_config_t *config)
|
||||||
{
|
{
|
||||||
esp_err_t ret = ESP_OK;
|
esp_err_t ret = ESP_OK;
|
||||||
|
@@ -382,6 +382,34 @@ 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 request user_data.
|
||||||
|
* The value stored from the esp_http_client_config_t will be written
|
||||||
|
* to the address passed into data.
|
||||||
|
*
|
||||||
|
* @param[in] client The esp_http_client handle
|
||||||
|
* @param[out] data A pointer to the pointer that will be set to user_data.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - ESP_OK
|
||||||
|
* - ESP_ERR_INVALID_ARG
|
||||||
|
*/
|
||||||
|
esp_err_t esp_http_client_get_user_data(esp_http_client_handle_t client, void **data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set http request user_data.
|
||||||
|
* The value passed in +data+ will be available during event callbacks.
|
||||||
|
* No memory management will be performed on the user's behalf.
|
||||||
|
*
|
||||||
|
* @param[in] client The esp_http_client handle
|
||||||
|
* @param[in] data The pointer to the user data
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - ESP_OK
|
||||||
|
* - ESP_ERR_INVALID_ARG
|
||||||
|
*/
|
||||||
|
esp_err_t esp_http_client_set_user_data(esp_http_client_handle_t client, void *data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get HTTP client session errno
|
* @brief Get HTTP client session errno
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user