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,59 @@
|
||||
/* host_repro.c — 复现 weapi login_status_check 断帧挂死/断头问题(宿主)
|
||||
* 用与 App 完全相同的 core 库路径:ncm_req_build(WEAPI) -> ncm_http_request。
|
||||
* 用法: ./host_repro [cookie]
|
||||
*/
|
||||
#include "ncm.h"
|
||||
#include "ncm_req.h"
|
||||
#include "ncm_http.h"
|
||||
#include "ncm_common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static void dump_resp(const char *tag, const ncm_http_resp_t *r) {
|
||||
printf("---- %s ----\n", tag);
|
||||
printf("status=%d content_length=%zu chunked=%d ct=%s\n",
|
||||
r->status, r->content_length, r->chunked,
|
||||
r->has_content_type ? r->content_type : "(none)");
|
||||
printf("headers(%zu):\n%s\n", r->headers_len, r->headers);
|
||||
printf("body_len=%zu\n", r->body_len);
|
||||
if (r->body_len) printf("body:\n%.*s\n", (int)r->body_len, r->body);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
const char *cookie = argc > 1 ? argv[1] : "__csrf=";
|
||||
const char *device = "68DFA27096B7A5DC2CB393C77D8C194FDC0459B743081D091EBD";
|
||||
|
||||
/* 同 App:用全局默认 CA(verify=1 + 系统CA) */
|
||||
ncm_http_set_verify_default(1, NULL);
|
||||
|
||||
char body[NCM_REQ_BODY_MAX], hdrs[NCM_REQ_HDRS_MAX], url[NCM_REQ_URL_MAX];
|
||||
int rc = ncm_req_build(device, cookie, "/api/w/nuser/account/get", "{}",
|
||||
NCM_CRYPT_WEAPI, body, sizeof body,
|
||||
hdrs, sizeof hdrs, url, sizeof url);
|
||||
printf("req_build rc=%d\n", rc);
|
||||
if (rc != NCM_OK) return 1;
|
||||
printf("URL: %s\n", url);
|
||||
printf("BODY(len=%zu): %.*s\n\n", strlen(body), (int)strlen(body), body);
|
||||
printf("HDRS:\n%s\n\n", 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;
|
||||
|
||||
char respbuf[8192];
|
||||
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("ncm_http_request rc=%d elapsed_ms=%ld\n", rc, dt);
|
||||
if (rc != NCM_OK) return 2;
|
||||
dump_resp("weapi account/get", &resp);
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user