fix(ws): validate CLOSE frame semantics, echo payload, validate UTF-8 text

This commit is contained in:
Ashish Sharma
2026-09-04 16:24:38 +08:00
parent ba2b9256e2
commit d0e35277dd
8 changed files with 363 additions and 130 deletions
@@ -215,9 +215,11 @@ static esp_err_t echo_handler(httpd_req_t *req)
}
}
ret = httpd_ws_send_frame(req, &ws_pkt);
if (ret != ESP_OK) {
ESP_LOGE(TAG, "httpd_ws_send_frame failed with %d", ret);
if (ws_pkt.type == HTTPD_WS_TYPE_TEXT || ws_pkt.type == HTTPD_WS_TYPE_BINARY) {
ret = httpd_ws_send_frame(req, &ws_pkt);
if (ret != ESP_OK) {
ESP_LOGE(TAG, "httpd_ws_send_frame failed with %d", ret);
}
}
free(buf);
return ret;