mirror of
https://github.com/espressif/esp-idf.git
synced 2026-06-04 20:26:38 +03:00
Merge branch 'feat/esp_http_client_get_socket_api' into 'master'
feat(esp_http_client): adds API to get transport socket Closes IDF-15052 See merge request espressif/esp-idf!45333
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
|
||||
*/
|
||||
@@ -2085,3 +2085,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
|
||||
*/
|
||||
@@ -902,6 +902,17 @@ esp_http_state_t esp_http_client_get_state(esp_http_client_handle_t client);
|
||||
*/
|
||||
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