fix(grok): 禁用 HTTP/2 协商以适配 axios

axios 底层仅支持 HTTP/1.1,强制协商 h2 会导致服务端返回的 H2 帧解析失败。将 ALPN 协议列表修改为仅 'http/1.1' 以确保连接兼容性。
This commit is contained in:
hex2077 2026-02-27 22:32:11 +08:00
parent 73079dc4ee
commit 89e80148d0

View file

@ -64,8 +64,9 @@ const httpsAgent = new https.Agent({
sigalgs: CHROME_SIGALGS,
minVersion: 'TLSv1.2',
maxVersion: 'TLSv1.3',
// Chrome 的 ALPN 协商顺序: h2 优先
ALPNProtocols: ['h2', 'http/1.1'],
// axios 仅支持 HTTP/1.1,不能协商 h2否则服务端返回 H2 帧会解析失败)
// 注意:真实 Chrome 会协商 h2但 Node.js http 模块不支持
ALPNProtocols: ['http/1.1'],
// Chrome 支持的 EC 曲线
ecdhCurve: 'X25519:P-256:P-384',
// 允许不安全的旧版协商 (Chrome 也允许)