mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
feat(esp_http_client): adds API to get transport socket
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user