feat(panel): 前端 NOT_JSON 自动回传原始响应到 /api/debug/report_bad_json(落 /tmp/overview_client_bad.txt,抓浏览器收到的真实字节)
This commit is contained in:
1 parent
57676766c0
commit
524e5d6967
2 files changed
+9
No files matched your search
@@ -5495,6 +5495,14 @@ static int handle(int sock, req_t *r)
|
||||
if (!strcmp(p, "/api/system/shutdown")) return api_system_action(sock, "shutdown", r);
|
||||
if (!strcmp(p, "/api/system/ota")) return api_system_action(sock, "ota", r);
|
||||
if (!strcmp(p, "/api/system/pin-unlock-once")) return api_pin_unlock_once(sock);
|
||||
if (!strcmp(p, "/api/debug/report_bad_json")) {
|
||||
/* 前端 NOT_JSON 自动回传浏览器收到的原始字节(抓间歇性破包) */
|
||||
FILE *df = fopen("/tmp/overview_client_bad.txt", "w");
|
||||
if (df && r->body && r->body_len) fwrite(r->body, 1, r->body_len, df);
|
||||
if (df) fclose(df);
|
||||
panel_log("debug: client bad json captured %zu bytes -> /tmp/overview_client_bad.txt", (size_t)r->body_len);
|
||||
return send_json(sock, 200, "{\"captured\":true}");
|
||||
}
|
||||
if (!strcmp(p, "/api/settings")) return api_settings_batch(sock, r);
|
||||
if (!strcmp(p, "/api/settings/restore")) return api_settings_restore(sock);
|
||||
if (!strcmp(p, "/api/theme")) return api_theme_put(sock, r);
|
||||
|
||||
Reference in new issue
Block a user