mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
esp_http_server: Fix ws server handle length over 1440(MTU) messages incorrectly.
Closes https://github.com/espressif/esp-idf/issues/7457
This commit is contained in:
parent
5bdbfd1d05
commit
5db3853c2c
@ -328,9 +328,19 @@ esp_err_t httpd_ws_recv_frame(httpd_req_t *req, httpd_ws_frame_t *frame, size_t
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (httpd_recv_with_opt(req, (char *)frame->payload, frame->len, false) <= 0) {
|
||||
ESP_LOGW(TAG, LOG_FMT("Failed to receive payload"));
|
||||
return ESP_FAIL;
|
||||
size_t left_len = frame->len;
|
||||
size_t offset = 0;
|
||||
|
||||
while (left_len > 0) {
|
||||
int read_len = httpd_recv_with_opt(req, (char *)frame->payload + offset, left_len, false);
|
||||
if (read_len <= 0) {
|
||||
ESP_LOGW(TAG, LOG_FMT("Failed to receive payload"));
|
||||
return ESP_FAIL;
|
||||
}
|
||||
offset += read_len;
|
||||
left_len -= read_len;
|
||||
|
||||
ESP_LOGD(TAG, "Frame length: %d, Bytes Read: %d", frame->len, offset);
|
||||
}
|
||||
|
||||
/* Unmask payload */
|
||||
|
Loading…
x
Reference in New Issue
Block a user