Merge branch 'feat/esp_http_client_get_socket_api_v5.5' into 'release/v5.5'

feat(esp_http_client): adds API to get transport socket (v5.5)

See merge request espressif/esp-idf!45373
This commit is contained in:
Jiang Jiang Jian
2026-01-23 10:29:26 +08:00
2 changed files with 22 additions and 2 deletions
+10 -1
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -2034,3 +2034,12 @@ bool esp_http_client_is_persistent_connection(esp_http_client_handle_t client)
}
return false;
}
int esp_http_client_get_socket(esp_http_client_handle_t client)
{
if (client == NULL || client->transport == NULL) {
return -1;
}
return esp_transport_get_socket(client->transport);
}
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -857,6 +857,17 @@ esp_err_t esp_http_client_get_chunk_length(esp_http_client_handle_t client, int
*/
bool esp_http_client_is_persistent_connection(esp_http_client_handle_t client);
/**
* @brief Get the socket from the underlying transport
*
* @param client The HTTP client handle
*
* @return
* - -1 if the client is NULL or the transport is not initialized
* - The socket file descriptor if successful
*/
int esp_http_client_get_socket(esp_http_client_handle_t client);
#ifdef __cplusplus
}
#endif