Get esp_http_client_config_t from esp_http_client_handle_t?

A6ESPF
Posts: 28
Joined: Tue Dec 10, 2019 12:16 pm

Get esp_http_client_config_t from esp_http_client_handle_t?

Postby A6ESPF » Tue Nov 29, 2022 12:00 pm

Is it possible to get the client configuration from the client handle after the client is initialized?
For example:

Code: Select all

char name[] = "example";
esp_http_client_config_t cfg =
{
    .host = "httpbin.org",
    .path = "/get",
    .method = HTTP_METHOD_GET,
    .user_data = name,
}
esp_http_client_handle_t cli = esp_http_client_init(&cfg);
Now, is it possible to access the client configuration in another function, something like this:

Code: Select all

esp_http_client_config_t* cfg = esp_http_get_client_config(cli);
More specifically, I'd like to access user_data field in the configuration.

ESP_YJM
Posts: 300
Joined: Fri Feb 26, 2021 10:30 am

Re: Get esp_http_client_config_t from esp_http_client_handle_t?

Postby ESP_YJM » Wed Nov 30, 2022 7:57 am

Sorry, there is no interface you want to get cfg, but you can get user_data here https://github.com/espressif/esp-idf/bl ... mple.c#L73

A6ESPF
Posts: 28
Joined: Tue Dec 10, 2019 12:16 pm

Re: Get esp_http_client_config_t from esp_http_client_handle_t?

Postby A6ESPF » Wed Nov 30, 2022 8:11 am

I see. Regarding user_data, is it possible to access it prior to http client perform function?

ESP_YJM
Posts: 300
Joined: Fri Feb 26, 2021 10:30 am

Re: Get esp_http_client_config_t from esp_http_client_handle_t?

Postby ESP_YJM » Thu Dec 01, 2022 7:05 am

No, No API to access this user_data. You can search the esp_http_client.c file to check user_data.

Who is online

Users browsing this forum: danpf1 and 105 guests