mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
ws_client: fix fragmented send setting proper opcodes
Previous implementation violated the RFC by having both the actual opcode and WS_FIN flag set for all fragments of a message. Fixed by setting the opcode only for the first fragment and WS_FIN for the last one Closes IDFGH-2938 Closes https://github.com/espressif/esp-idf/issues/4974
This commit is contained in:
@@ -20,6 +20,7 @@ typedef enum ws_transport_opcodes {
|
||||
WS_TRANSPORT_OPCODES_CLOSE = 0x08,
|
||||
WS_TRANSPORT_OPCODES_PING = 0x09,
|
||||
WS_TRANSPORT_OPCODES_PONG = 0x0a,
|
||||
WS_TRANSPORT_OPCODES_FIN = 0x80,
|
||||
} ws_transport_opcodes_t;
|
||||
|
||||
/**
|
||||
|
@@ -259,7 +259,7 @@ int esp_transport_ws_send_raw(esp_transport_handle_t t, ws_transport_opcodes_t o
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
ESP_LOGD(TAG, "Sending raw ws message with opcode %d", op_code);
|
||||
return _ws_write(t, op_code | WS_FIN, WS_MASK, b, len, timeout_ms);
|
||||
return _ws_write(t, op_code, WS_MASK, b, len, timeout_ms);
|
||||
}
|
||||
|
||||
static int ws_write(esp_transport_handle_t t, const char *b, int len, int timeout_ms)
|
||||
|
Reference in New Issue
Block a user