fix(ncm): weapi挂死根因修复 (agent-207, 6缺陷叠加) — ①超时改CLOCK_MONOTONIC(墙钟NTP回拨致poll超长阻塞) ②响应头解析隔行跳行漏Content-Length ③请求头缓冲1KB→8KB ④cookie值截断192B致MUSIC_U不完整被当游客(改ptr+len不截断+按名去重) ⑤split处NUL覆盖body首字节 ⑥Content-Length:0直接DONE; status_check硬上限6s; 803后worker线程取uid/nick落盘(修uid恒空)
ncm→bf6d2a79 已部署; 真机1次验证(风控合规): status_check 721ms rc=0 uid=408996274; user_playlist 2.5s rc=0 count=64
This commit is contained in:
1 parent
4ff8c8baa3
commit
a651df0e9b
19 files changed
+466
-71
No files matched your search
@@ -0,0 +1,41 @@
|
||||
/* dev_repro2.c — 真机 dump weapi account/get 响应的真实分段(Content-Length/chunked/body_len)。
|
||||
* 用大缓冲 64KB,避免 -11 FULL;打印解析出的 status/content_length/chunked/body_len。
|
||||
*/
|
||||
#include "ncm.h"
|
||||
#include "ncm_req.h"
|
||||
#include "ncm_http.h"
|
||||
#include "ncm_common.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
const char *data_dir = argc > 1 ? argv[1] : "/usr/data/mnt/sd_0/MeowData/os.meow.ncm/data";
|
||||
const char *cacert = argc > 2 ? argv[2] : "/usr/data/mnt/sd_0/MeowAPPs/os.meow.ncm/cacert.pem";
|
||||
|
||||
ncm_ctx_t ctx;
|
||||
ncm_ctx_init(&ctx, data_dir);
|
||||
printf("device_id=%s cookie_len=%zu\n", ctx.device_id, strlen(ctx.cookie));
|
||||
ncm_http_set_verify_default(1, cacert);
|
||||
|
||||
char body[NCM_REQ_BODY_MAX], hdrs[NCM_REQ_HDRS_MAX], url[NCM_REQ_URL_MAX];
|
||||
int rc = ncm_req_build(ctx.device_id, ctx.cookie, "/api/w/nuser/account/get", "{}",
|
||||
NCM_CRYPT_WEAPI, body, sizeof body, hdrs, sizeof hdrs, url, sizeof url);
|
||||
if (rc != 0) { printf("req_build rc=%d\n", rc); return 1; }
|
||||
printf("URL=%s\nbody_len=%zu hdrs_len=%zu\n", url, strlen(body), strlen(hdrs));
|
||||
|
||||
ncm_http_req_t req; memset(&req, 0, sizeof req);
|
||||
req.url = url; req.method = "POST"; req.body = body; req.body_len = strlen(body);
|
||||
req.extra_hdrs = hdrs; req.verify_ca = NCM_HTTP_VERIFY_DEFAULT; req.timeout_ms = 15000;
|
||||
|
||||
static char respbuf[65536];
|
||||
ncm_http_resp_t resp;
|
||||
long t0 = (long)ncm_now_ms();
|
||||
rc = ncm_http_request(&req, respbuf, sizeof respbuf, &resp);
|
||||
long dt = (long)ncm_now_ms() - t0;
|
||||
printf("http_request rc=%d elapsed_ms=%ld\n", rc, dt);
|
||||
printf("status=%d content_length=%zu chunked=%d\n", resp.status, resp.content_length, resp.chunked);
|
||||
printf("headers_len=%zu\n", resp.headers_len);
|
||||
printf("body_len=%zu\n", resp.body_len);
|
||||
if (resp.body_len) printf("body_head:\n%.*s\n", (int)(resp.body_len < 800 ? resp.body_len : 800), resp.body);
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user