mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-15 03:26:36 +02:00
fix(websocket): esp_websocket_client client allow sending 0 byte packets
This commit is contained in:
@ -1100,8 +1100,7 @@ int esp_websocket_client_send_with_opcode(esp_websocket_client_handle_t client,
|
|||||||
int wlen = 0, widx = 0;
|
int wlen = 0, widx = 0;
|
||||||
int ret = ESP_FAIL;
|
int ret = ESP_FAIL;
|
||||||
|
|
||||||
if (client == NULL || len < 0 ||
|
if (client == NULL || len < 0 || (data == NULL && len > 0)) {
|
||||||
(opcode != WS_TRANSPORT_OPCODES_CLOSE && (data == NULL || len <= 0))) {
|
|
||||||
ESP_LOGE(TAG, "Invalid arguments");
|
ESP_LOGE(TAG, "Invalid arguments");
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -254,6 +254,9 @@ int esp_websocket_client_send_text(esp_websocket_client_handle_t client, const c
|
|||||||
* @param[in] len The length
|
* @param[in] len The length
|
||||||
* @param[in] timeout Write data timeout in RTOS ticks
|
* @param[in] timeout Write data timeout in RTOS ticks
|
||||||
*
|
*
|
||||||
|
* Notes:
|
||||||
|
* - In order to send a zero payload, data and len should be set to NULL/0
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
* - Number of data was sent
|
* - Number of data was sent
|
||||||
* - (-1) if any errors
|
* - (-1) if any errors
|
||||||
|
Reference in New Issue
Block a user