Repository navigation
Upgrade to Nginx 1.31.9 - #3
Merged
Merged
Conversation
…-overflow-ngx-dubbo-util fix: Use copied string length consistently in ngx_dubbo_util
…testcase Add test case about CVE-2026-42945
…onses The server_tag directive (off/custom) was ignored in HTTP/2 and HTTP/3 responses because both ngx_http_v2_filter_module and ngx_http_xquic_filter_module only checked server_tokens without considering server_tag_type. This caused the Server header to always appear in HTTP/2 and HTTP/3 responses even with 'server_tag off' configured. Add T_NGX_SERVER_INFO conditional checks for server_tag_type in both the HTTP/2 header filter and the HTTP/3 (xquic) header filter, consistent with the HTTP/1.x header filter logic. Fixes alibaba#2004
Restructure the conditional flow to be linear: handle OFF and CUSTOMIZED cases first with early exit, then fall through to the common server_tokens logic in an else block. This eliminates split if-chains caused by #if preprocessor directives and improves readability across all three header filter modules.
…ue-2004 fix(http2,h3): respect server_tag directive in HTTP/2 and HTTP/3 responses
alibaba#2035) * fix: CVE-2026-9256 - heap buffer overflow with overlapping captures in ngx_http_rewrite_module Rewrite: fix buffer overflow with overlapping captures. When the rewrite replacement string had no variables, but had overlapping captures (the same input region referenced by multiple capture groups, e.g. ^/((.*))$ where $1 and $2 both reference the same data), the length of the allocated buffer could be smaller than the actual replacement string. This happened either when the "redirect" parameter was specified, or when arguments were present in the replacement string. The pre-fix code estimated the escape expansion once for the whole r->uri while the write path applied ngx_escape_uri() to each capture individually. With overlapping captures the same characters were escaped multiple times during write but counted only once during allocation, resulting in a heap buffer overflow. The following configurations resulted in heap buffer overflow when using URI "/++++++++++++++++++++++++++++++": location / { rewrite ^/((.*))$ http://127.0.0.1:8080/$1$2 redirect; return 200 foo; } location / { rewrite ^/((.*))$ http://127.0.0.1:8080/?$1$2; return 200 foo; } Fix: move the escape length calculation into the captures loop so each capture escape expansion is accounted for individually, matching the write path exactly. Additionally, harden escape flags control following CVE-2026-42945: - Explicitly reset e->is_args to 0 at rewrite start. If the flag was set by a prior rewrite, buffer overflow could happen before the previous fix. - Copy le.is_args from e->is_args when calculating complex value length for "if" and "set" directives. If e->is_args was set but le.is_args was not, buffer overflow could happen. Reported by Mufeed VH of Winfunc Research. Affected: Tengine 3.1.0 and earlier CVSS: Medium * test: fix CVE-2026-9256 rewrite_overlap_captures.t syntax error Use qr{...} delimiters instead of qr|...| because the regex contains '|' alternation inside (?:...) groups, which conflicted with the '|' delimiter and caused the test to die before reaching plan(), resulting in TAP "No plan found" failure in CI. * test: relax CVE-2026-9256 PoC #2 assertion to focus on crash regression The previous assertion required the response body to contain exactly 128 consecutive '+' or '%2B' characters, which depends on subtle args escaping behavior and turned out to be too strict in CI. CVE regression tests should verify the absence of heap overflow / crash, not the exact post-rewrite body content. Replace the body match with a relaxed check: status 200 and presence of the "args=" marker, which is sufficient evidence that the worker did not crash on the overlapping captures payload. * test: rewrite_overlap_captures.t PoC #2 only asserts no crash The previous relaxation still required HTTP status 200, which CI showed to be too strict: post-fix the server may legitimately return a non-200 status (e.g. URI processing edge case) for the malformed PoC payload. The CVE-2026-9256 regression test should only verify the absence of a crash. Pre-fix, the worker would segfault on the overlapping captures payload and the connection would be reset, so http_get would return empty/undef. Post-fix, any well-formed HTTP response indicates the worker survived. Replace the body match with: response is non-empty and starts with a valid HTTP status line. Add diag() to print the response head if it is abnormally short, to aid future debugging without failing the test.
…ver lower latency, higher resilience to packet loss, and improved performance on unstable/mobile networks (alibaba#2039) * HTTP/3: connection management and multiplexing work in tandem to deliver lower latency, higher resilience to packet loss, and improved performance on unstable/mobile networks * HTTP/3: connection management * HTTP/3: comments update * HTTP/3: comments update * HTTP/3: struct ngx_http_xquic_connection_s * HTTP/3: add XQC_ENABLE_RENO for xqc_reno_cb * HTTP/3: NGX_XQUIC_SUPPORT_CID_ROUTE * Ingress: C89(ANSI C) with ingress for loop * HTTP/3: add macro XQC_COMPAT_DUPLICATE * HTTP/3: GCC warn of ngx_http_xquic_module * HTTP/3: remove diamond and cc config from test * Test: dns_server_daemon wait and retry * HTTP/3: xquic module warning for CI/CD * HTTP/3: remove dead on_block labels, cast atomic to ngx_msec_t in ngx_http_v3_check_request_limit and drop unused qmcf in ngx_http_v3_priority * HTTP/3: unused stats, left_size and last_out in xquic module * HTTP/3: close reload_conn in ngx_xquic_intercom_exit, mark it shared so master keeps the fd * HTTP/3: update comments of test case
* HTTP/3: connection management and multiplexing work in tandem to deliver lower latency, higher resilience to packet loss, and improved performance on unstable/mobile networks * HTTP/3: connection management * HTTP/3: comments update * HTTP/3: comments update * HTTP/3: struct ngx_http_xquic_connection_s * HTTP/3: add XQC_ENABLE_RENO for xqc_reno_cb * HTTP/3: NGX_XQUIC_SUPPORT_CID_ROUTE * Ingress: C89(ANSI C) with ingress for loop * HTTP/3: add macro XQC_COMPAT_DUPLICATE * HTTP/3: GCC warn of ngx_http_xquic_module * HTTP/3: remove diamond and cc config from test * Test: dns_server_daemon wait and retry * HTTP/3: xquic module warning for CI/CD * HTTP/3: remove dead on_block labels, cast atomic to ngx_msec_t in ngx_http_v3_check_request_limit and drop unused qmcf in ngx_http_v3_priority * HTTP/3: unused stats, left_size and last_out in xquic module * HTTP/3: close reload_conn in ngx_xquic_intercom_exit, mark it shared so master keeps the fd * HTTP/3: update comments of test case * CVE-2026-49975: HTTP/2 Bomb * Test: move rewrite case to tengine-tests * Test: add test case about new directive http2_max_headers for CVE-2026-49975, * CVE-2026-49975: H2/HPACK boom and H3/QPACK boom * Test: test plan of H3 max headers should be 6
…baba#2042) * CVE-2026-49975: warn log about too many headers of H2 and H3 * CVE-2026-49975: warn log about too many headers of H1
…y to fix Tongsuo build
Update to nginx 1.31.4 and xquic v1.9.6 for 3.2.0-rc4
openEuler 镜像的仓库默认走 mirrors.openeuler.org 的 metalink,而它给出的 镜像站都在国内:GitHub runner 上只有几 kB/s,librepo 以 "Operation too slow" 和 HTTP/2 流截断逐个放弃镜像,cmake(约 30 MB)必然下载失败,整个 dnf 事务随之报错。 * openEuler 的 repo 文件(baseurl 与 gpgkey)改指华为云镜像,同一份目录树 走 CDN,并注掉 metalink —— 否则它会盖掉改写后的 baseurl。改写后校验至少 命中一条 baseurl,避免出现"metalink 已注、baseurl 未匹配"的无源仓库, 以"找不到包"的形式莫名失败。 * openEuler 上把 dnf 限成单连接下载(max_parallel_downloads=1,另加 timeout / retries / minrate):并行下载复用同一条 HTTP/2 连接,一个流被 重置会带走整批。只对 openEuler 生效 —— 这些是 dnf 4 的选项名,el10 用的 是 dnf 5,不认识的选项会直接报错。 * rpm 家族的 dnf / yum 安装统一由 retry_install 重试 4 次(10s 起指数退避), 已下载的包留在 cache,重试只补缺失部分;el7 取 Kitware CMake 的 curl 也 补上 --retry。 验证:build.sh 与抽出的 bootstrap 片段 sh -n 通过;retry_install 的成功、 退避、放弃与 set -e 传播四条路径实测符合预期;sed 对官方 repo 文件样本 (http:// 的 baseurl 加 metalink)改写正确,ID="openEuler" 与 ID=openEuler 均识别、rocky 不误伤;华为云上 22.03-LTS-SP4 与 24.03-LTS 的 OS / update / everything / EPOL、双架构、RPM-GPG-KEY-openEuler,以及失败 日志里的 cmake-3.22.0-11.oe2203sp4.aarch64.rpm 实测均 200。本机无 docker,容器内 bootstrap 的端到端执行未跑,华为云在 runner 上的实际速率 需重跑 openeuler2203 确认。
Packaging: pin the openEuler build repos to a CDN mirror
私有轮询优化(T_NGX_HTTP_UPSTREAM_RANDOM、T_NGX_HTTP_ROUND_ROBIN_OPT_ALI) 把 peer 的位置下标当作环形扫描的坐标,并把上次选中的位置缓存在 peers 里。 这套坐标只在 peer 集合不变时成立,而同步进来的 server ... resolve 让 resolver 在运行期增删 peer:peers->number 可以为 0,位置会整体漂移,被 缓存的 peer 也可能已经释放。acd315ef 引入环形扫描时这些前提都还成立, a626271 之后不再成立,6f68d662 的位置缓存又放大了后果。 * peers->number 为 0 时(首次解析成功之前,以及空答案或否定答案之后): ngx_random() % number 与 discarded_number %= discarded_range 除零。 x86_64 上是 SIGFPE;arm64 的 UDIV 不陷入,随后解引用空链表得到 SIGSEGV。 get_peer 开头直接返回 NULL,权重预热那段一并跳过。 * last_number 是选中时的位置,同时用来索引 rrp->tried。peer 集合一变位置 就漂移,位图记到别的 peer 上:某个 peer 被试两次,另一个从未被试。改为 连同 *peers->config(zone 模块每次增删都自增)一起缓存,代次不符就整表 重扫,与 hash / random / ip_hash 判断缓存失效的方式一致。 * init_number 是一次性抽取的位置,存在共享内存里长期复用,从不重算。 resolver 缩小 peer 集后它可能越过链表尾,起点定位走到 NULL 被解引用; 即使不崩,i = (i + 1) % number 也永远回不到起点,worker 自旋到被强杀。 使用前收回当前范围,与同文件 adapte_rr_peer_weight 的写法一致。 * 摘除 peer 时清掉指向它的 last_peer,避免悬垂指针。 新增 tengine-tests/upstream_resolve_empty.t(空 peer 集)与 tengine-tests/upstream_resolve_shrink.t(缩容后 init_number 越界)。 验证(macOS clang): * ASan 构建下 upstream 相关 11 个文件 140 个断言全通过。同一构建还原未打 补丁的代码后,upstream_resolve.t 失败 9、12,upstream_service.t 失败 21 项(与 issue 报告的 16-25、27-29、31-39 吻合),upstream_sticky_resolve.t 失败 12-13、15-16,报告 SEGV 于 ngx_http_upstream_get_round_robin_peer ← get_keepalive_peer ← ngx_event_connect_peer。 * 逐条单变量对照:只短路 last_config 校验,upstream_resolve.t 第 9 项 ('A AAAA AAAA 1') 确定性失败 2/2,实际响应把 fe80::1 试了两次而 127.0.0.201 一次未试;只短路 init_number 收敛,upstream_resolve_shrink.t 失败且 CPU 时间 89s(自旋),修复后 0.13s。 * nginx-tests 的 upstream 子集 24 个文件 247 个断言全通过; upstream_resolve.t 连跑 3 次均 20/20。 * 三种宏组合(默认、T_NGX_HTTP_UPSTREAM_RANDOM=0、 T_NGX_HTTP_ROUND_ROBIN_OPT_ALI=0)-Werror 编译无告警。 upstream_sticky.t / _drain / _learn / _learn_header / _route 在宏开与关 两种构建下都失败,且失败项不固定,是与本轮无关的既有问题,未纳入。 相关 issue: alibaba#2102
上一个提交里的崩溃此前没有任何 job 能覆盖到:nginx-tests/ 的官方用例只由 test-nginx-core.yml 执行,而它的 cc-opt 带 -D T_NGX_HTTP_UPSTREAM_RANDOM=0, 恰好把出问题的私有轮询代码编译掉;ci.yml 的构建宏全开,却只跑 tengine-tests/ 与各模块自带的 t/。 * ci.yml —— prove 列表追加 upstream_resolve、upstream_resolve_reload、 upstream_service、upstream_sticky_resolve、upstream_zone、 upstream_zone_ssl 六个官方用例。该构建私有宏全开,且这六个用例只依赖 已经编译进去的模块。 * test-nginx-core.yml —— 新增 upstream-private-round-robin-test,不带任何 -D 覆盖、最小模块集,只跑 upstream 子集与两个新增的 tengine 用例。sticky 族 5 个文件排除:它们在宏开与关两种构建下都失败且失败项不固定,属另一簇 既有问题,纳进来只会让这个 job 长期红着而失去信号。 * test-asan.yml —— 新建。其余 job 都不带 sanitizer,而越界读、共享内存里 peer 的 use after free、除零这几类问题在无 sanitizer 的构建下可能只表现 为偶发崩溃甚至静默通过。Test::Nginx 的 DESTROY 里有 no sanitizer errors 断言(grep error.log 的 Sanitizer 行),所以报告本身就会让用例失败。 detect_leaks=0:nginx 按设计不释放 pool,退出时的 LSan 报告会淹没信号。 cc-opt 带 -Wno-error(sanitizer 会让优化器报出其他 job 不会报的告警), 其他 job 保持 -Werror 不变。 验证:三个 workflow 均通过 yaml.safe_load;ci.yml 追加的六个用例在私有宏 全开的本地构建下全部通过;core 新 job 的确切 prove 命令 24 个文件 247 个 断言全通过;asan job 的用例集在真实 ASan 构建下 11 个文件 140 个断言全 通过(同一构建还原未修复的代码则复现 SEGV)。 相关 issue: alibaba#2102
Upstream: fix the round robin crashes with re-resolvable servers and cover the private round robin code in ci
为 tengine-tests 下缺失版权声明的用例补充 Alibaba 版权头,年份按 git 首次提交时间确定;修正此前误填的年份及 stream_ssl_handshakd_time 尾部多余句点;已有第三方署名的用例并列追加公司版权,保留原作者署名;顺带纳入 upstream_resolve_empty 的 keepalive+resolve 组合回归用例。
test: add and normalize copyright headers in tengine-tests
主要内容:
* Control API(--with-control-api,默认关闭)。新增 src/os/unix/ngx_control.
{c,h},master 起一条 UNIX/inet 监听,worker 走 ngx_channel 协作;HTTP 端点
/1/nginx 返回版本与 build,/1/control/processes 报进程,/1/control/config
的 GET 是 config dump、PATCH 触发 reload 并回 {"logs":[]}。
* Predicate locations。ngx_http_core_loc_conf_t 新增 predicate(变量索引
+1)与 predicate_locations,ngx_http_init_locations、
ngx_http_init_static_location_trees 与 ngx_http_cmp_locations 相应改动。
* ngx_http_json_module(--with-http_json_module,默认关闭)。json_set
$dst $source <path> 按点/括号记法(a[2].b)取值,json_max_depth 封顶;
配套新增 src/core/ngx_json_parse.{c,h} 与 ngx_json_unescape.{c,h},已登记
进 auto/sources 与 ngx_core.h。
* client_body_early_read 指令(MAIN/SRV 级,走 ngx_http_set_predicate_slot),
ngx_http_request.c 新增 ngx_http_read_early_body()。
* 修 proxy 带 buffering 时向 HTTP/2 客户端发响应出错引发的 use-after-free。
* 修 worker 在优雅退出前耗尽 fd 时不退出、或日志里出现 accept4() failed
(9: Bad file descriptor) 的问题。
* 修 FastCGI 与 uwsgi 在参数名过长时请求报文畸形。
* ngx_http_slice_filter_module 的 bytes= 区间计算溢出、memcached 与 HTTP/3
的若干修正。
跳过:src/event/quic/ngx_event_quic_ssl.c(tengine 的 HTTP/3 走 XQUIC,无
nginx 原生 QUIC 栈),以及 tengine 不存在的 misc/GNUmakefile 与 nginx 仓库
专属的 docs/xml/nginx/changes.xml。
冲突处理:
* Control API 的监听地址上游用 -l,与 tengine 的 T_NGX_SHOW_INFO 冲突——
后者默认开启(auto/modules 无条件置 T_NGX_SHOW_INFO)、-l 已用于列出所有
指令且在 -h 里有文档,直接合入会 duplicate case value '108'。保留 tengine
的 -l,control socket 改用 -L,改动限于 nginx.c 的 case 分支、-h 文本与
缺参数时的错误消息三处;ngx_control.c 内部不引用该字母,不受影响。
* auto/options 的两个 hunk 因 tengine 在 --with-http_slice_module 之后多了
--with-http_tunnel_module 而 reject,手工把 --with-http_json_module 插在
slice 与 tunnel 之间,保持与上游一致的相对顺序。
* ngx_http_request.c 的前向声明 hunk 因 tengine 把
ngx_http_process_request_header 改成非 static 而 reject,手工补
ngx_http_read_early_body 的声明。
* ngx_conf_file.c、ngx_json.c、ngx_event_pipe.c、
ngx_http_slice_filter_module.c、ngx_channel.c 五个文件相对 1.31.4 基线零
定制,直接取上游版本。modules/ngx_http_slice_module 是与上游 slice filter
完全不同的实现(begin/end 参数,不走 bytes= 拼接),上游的溢出修复无需二次
移植。
验证:
* 含 --with-control-api --with-http_json_module 编译通过,仅剩 http/v2 两个
既有告警。逐文件核对 15 个 patched 文件的 +/- 行集合与上游 1.31.4→1.31.5
的改动集一致。
* 冒烟:-v 报 nginx/1.31.5;-h 同时列出 -L addr 与 -l;/1/nginx、
/1/control/processes、GET/PATCH /1/control/config 均正常,reload 后服务
存活;json_set 取 a[2].b 成功;client_body_early_read 生效。
* 回归用 git worktree 在 1.31.4 上以相同 configure 选项建基线做 A/B,515 个
nginx-tests 用例基线 38 失败、本轮 37 失败。唯一只在本轮失败的
upstream_sticky_learn_header.t 单独跑 3 轮 A/B(基线 3/3 失败、本轮 2/3
失败),确认是本机环境 flaky 而非回归;其余 36 个共同失败为既有问题
(SSL 类与 tengine server_tokens 定制)。排除的 mail_ssl_conf_command.t 与
stream_ssl_conf_command.t 在本机会挂起,与本次改动无关。
基线由上游 nginx-tests 5432676 推进到 ed41edf。本轮新增 28 个用例文件,均直接
取上游版本(这些文件此前本地不存在)。
新增:
* client_body_early_read.t —— ed41edf,配合本轮 core 的 client_body_early_read
指令。
* http_location_predicate.t / http_location_predicate_extra.t —— 7415953 /
5432676。上一轮(1.31.4)因 core 尚无 predicate locations 而跳过,本轮
core 已补齐,补回。
* h2_max_headers.t —— f89b3b6,上游 max_headers 用例。与 tengine-tests 下同名
的自研 HTTP/2 Bomb 回归用例是两个不同文件,分处不同目录、由不同 job 运行,
互不影响;tengine core 有 max_headers 指令(默认 1000),本机实测通过。
* h3_*.t(19 个)与 quic_*.t(5 个)—— 上游原生 QUIC 栈的用例。tengine 的
HTTP/3 走 XQUIC,nginx -V 不含 http_v3,has(http_v3 cryptx) 走字面正则回退
返回 0,本机跑全部干净 skip(Result: PASS),不会误红。补进来是为将来对齐
上游文件清单,并在 CI 里提供存在性覆盖。
CI:test-nginx-core.yml 的 configure 加上 --with-control-api(在 --with-pcre
之后)与 --with-http_json_module(在 --with-http_slice_module 之后)。这两个
选项默认关闭,不加则本轮 core 新增的约 2600 行代码(ngx_json_parse、
ngx_json_unescape、ngx_http_json_module、ngx_control)在任何 job 里都不会被
编译。该 job 不带 master_process off,不会触发 control API 单进程模式告警。
不处理:
* tunnel.t / tunnel_auth_basic.t / tunnel_next_upstream.t —— 已存在于
tengine-tests/ 且与上游逐字节相同,由 ci.yml 的 native-tunnel-test 独立
job 用 --with-http_tunnel_module(不链接 proxy_connect)运行;两个 CONNECT
实现无法同时链接,不搬入 nginx-tests/。
* 99 个陈旧文件(含 lib/Test/Nginx*.pm 缺失的 IO::Socket::SSL 2.091~2.095
workaround 与缩进错乱)以及本地多出的 njs、proxy_protocol_{,2}_{port,
server} 冗余用例,属历史欠账,与本轮版本增量无关,留待后续专项对齐。
验证:h2_max_headers.t + h3_*.t + quic_*.t 共 25 个文件本机跑 Result: PASS
(h2_max_headers 通过,其余按预期 skip)。
3.2.0 尚未正式发版(rc1~rc4 都是 pre-release),所以 CHANGES.te 与 CHANGES.cn 里已有的基线记录就地改数字,不新增条目。 * CHANGES —— 头部插入 nginx 1.31.5 段(02 Sep 2026),内容取自上游 docs/xml/nginx/changes.xml 的英文 para,按本文件既有的 76 列排版。 * CHANGES.te / CHANGES.cn —— "update core to Nginx-1.31.4" 改 1.31.5,并各 新增一条:control API 的监听地址用 -L 而非 nginx 1.31.5 的 -l(后者在 tengine 已用于列出所有指令),且 control API 仅在 --with-control-api 时编译。 * README.markdown —— Features 首行的 nginx-1.31.4 改 1.31.5。
Core: sync core and test cases up to nginx 1.31.5
上一轮同步把上游 24 个 h3_*.t/quic_*.t 全部搬了进来,但 Tengine 的 HTTP/3 由 XQUIC 实现,这些用例一律要求 has(http_v3) —— 在我们的 configure 参数里匹配不到 任何东西,于是全部 skip,零覆盖价值。 本次移除其中 11 个测原生 QUIC 传输层与 TLS 栈实现细节的用例。它们断言的是 nginx 自带 QUIC 栈的内部行为(密码套件协商、密钥更新、连接迁移、地址验证 Retry、stream final size、拥塞控制下的 ACK、TLS early data 与会话恢复、ssl_reject_handshake、 SNI),XQUIC 自带 TLS 层与拥塞控制,这些断言不可移植;SNI 与多证书场景已由 modules/ngx_http_xquic_module/test/test_multi_certs.py 覆盖。 保留 13 个通用 HTTP/3 协议语义用例(headers、request body、trailers、proxy、 limit_conn/limit_req、max_headers、server_name/server_tokens、absolute_redirect、 keepalive、proxy_max_temp_file_size)。它们考核的是任何符合规范的 HTTP/3 实现都 该满足的行为,是后续适配到 XQUIC 的候选,故维持上游原样不动。
对齐 99 个共有用例文件与上游差异时发现,噪声(缩进漂移、过时守卫、注释格式)里
藏了三处真实的功能欠账,此前一直没被察觉:
* Test/Nginx/Stream.pm 缺 IO::Socket::SSL 2.091~2.095 的 sysread workaround。
这几个版本的 sysread 在正常读到 EOF 时返回 undef 而非空串,上游为此在 read()
里补了兜底;缺了它,装有这些版本的发行版上 stream SSL 用例会假红。
* Test/Nginx.pm 的 has('openssl:X.Y.Za') 判据丢掉了 patch letter:正则只取
([0-9.]+),把 1.0.2a 的 a 直接扔掉,于是 1.0.2 与 1.0.2a 无法区分,相关用例
会误跑或误 skip。改回上游的 unpack("C*", ...) 逐字节比较。
* Test/Nginx.pm 的 http_start() 无条件对 socket 调 get_cipher() 与
peer_certificate()。用例传 SSL_startHandshake => 0 做延迟握手时,此时握手尚未
完成,这两个调用是错的。改回上游的 SSL_startHandshake 保护。
Tengine 侧的三项定制原样保留:testdir 下 mkdir logs(XQUIC 用例的
xquic_log logs/xquic.log 依赖它)、upstream_keepalive 判据的 add-module 分支
(Tengine 把 keepalive 做成 add-module)、has_module('lua') 时注入的
lua_package_path。
99 个共有用例文件与上游存在差异,此前记为「历史欠账,留待后续专项对齐」。逐 hunk
分析后确认,除上一个 commit 修掉的三处功能欠账外,其余全是三类无功能影响的漂移,
本次一并对齐;Tengine 的必要定制原样保留。
清理的三类:
* 缩进错乱与空行漂移(Test/Nginx/{IMAP,POP3,SMTP}.pm 忽略空白后与上游零差异,
HTTP2.pm 仅 buf 字段顺序不同)。
* 过时的 TODO 守卫。形如 local $TODO = 'not yet' unless has_version('1.21.0'),
上游早已删除。Tengine 的 -V 输出 nginx version: nginx/1.31.5,has_version 能
正常解析,故这些守卫在 1.31.5 上恒为真(或恒为假),既不生效也不掩盖回归,是
纯死代码。同时清掉几处上游已删的 todo_alerts/todo_skip。
* 注释里的 commit hash。Tengine 侧留的是旧的 mercurial 短 hash,上游迁移到 git
后已重写为 git hash。对齐后注释指向的才是真实可查的 commit。
保留的 Tengine 定制,差异从 99 收敛到 43,且每一条都能对应一个明确理由:
* 38 个文件的 worker_processes 1;(Tengine 默认 worker_processes auto,而上游用例
假定单 worker)
* http_resolver.t、stream_status_variable.t 的 skip(dyn_resolve 无 resolver 时
有意回退到 /etc/resolv.conf,请求会被解析而非返回 502)
* proxy_xar.t 的 method: POST(T_NGX_X_ACCEL_REDIRECT 默认开启,在
X-Accel-Redirect 上保留原请求方法而非重置为 GET)
* stub_status.t 的 request_time 列(T_NGX_HTTP_STUB_STATUS 多输出一列)
* lib/Test/Nginx.pm 的三项(见上一个 commit)
Tengine 的 HTTP/3 由 XQUIC 实现,从上游继承的 13 个通用 h3_*.t 因 has(http_v3)
匹配不到我们的 configure 参数而全部 skip。这些用例考核的是任何符合规范的 HTTP/3
实现都该满足的协议语义(headers、request body、trailers、limit_conn/limit_req、
max_headers 等),而非原生栈内部行为,适配过来是有价值的 —— 但前提是上游那个纯
Perl QUIC 客户端 Test::Nginx::HTTP3 能与 XQUIC 握手。
本用例只回答这一个问题:Test::Nginx::HTTP3 能否对 XQUIC 监听器完成 QUIC 握手并
交换一次 HTTP/3 请求。能,则 13 个通用用例可按本文件的配置模板逐个移植(把
listen ... quic 换成 XQUIC 的 xquic_log / xquic_ssl_certificate{,_key} /
listen ... xquic);不能,则失败信息会记下卡在哪一步,HTTP/3 覆盖继续依赖 XQUIC
自带的 test_client 与 test/*.py。
落位在 modules/ngx_http_xquic_module/t/ 而非 tests/nginx-tests/:test-ntls.yml
的 prove 已经收集这个目录,无需改 workflow,也不会污染与上游对齐的用例目录。
实现细节:
* has('xquic') 走 has_module() 的字面正则回退,匹配 configure 参数里的
--add-module=modules/ngx_http_xquic_module;cryptx 用于 gate
Test::Nginx::HTTP3 依赖的 CryptX 模块。
* todo_alerts() 是必需的,理由同 ngx_http_xquic.t:跑 XQUIC 本身就会产生与用例
无关的 alert(非阿里内核上的 setsockopt(new-udp-hash)、关闭时的 open socket
left in connection)。
* 私钥 chmod 0644:XQUIC 在 worker 降权后才读证书,不可读会导致 worker 直接以
fatal code 退出。
* 握手用 eval 包住并把 $@ 送进 diag,握手失败本身就是本探针要记录的结果。
Tests: add test cases about core and xquic
a5a2699 修复了私有轮询优化在 "server ... resolve" 运行期增删 peer 时的两处崩溃,但没有补 changelog。补在同批 round-robin 与 resolver 条目之后:首次解析成功前的除零,以及缓存位置过期后错记 tried 位图。
Docs: record the round robin crash fix for re-resolvable servers
HPACK 预编码常量原先用字符串字面量初始化,而数组长度恰好等于字节数, 没有为 NUL 留出位置。GCC 15 与 Clang 21 新增的 -Wunterminated-string-initialization 随 -Wextra 默认开启,配合 Tengine 默认的 -Werror,会使构建在 ngx_http_v2_filter_module.c 处直接失败。 改用显式字节列表初始化,字节值与原先逐字节一致,语义不变。涉及三处: T_NGX_SERVER_INFO 开启与关闭两个分支下的 server 名,以及 accept-encoding 请求头。相比 nonstring 属性(GCC 专有扩展)或全局关闭该诊断,这种写法 不依赖特定编译器,也不会掩盖其他位置的同类问题。
现有 workflow 的 runs-on 全部钉在 ubuntu-24.04(GCC 13 / Clang 18),而新
编译器引入的诊断在旧工具链上并不存在,无法靠调整编译选项发现,形成结构性
盲区:package.yml 虽有 ubuntu2604 目标,但仅在打标签或手动触发时运行。
新增 .github/workflows/compiler-warnings.yml,在 ubuntu-26.04(GCC 15 /
Clang 21)上编译,含四个 job:
strict 保留 -Werror,覆盖 debug 与 release 两种配置,其中
release 关闭 T_NGX_SERVER_INFO,使该宏两个分支下的
代码都被编译
inventory 改用 -Wno-error 配合 make -k,一次列全所有命中点,
避免 -Werror 在首个诊断处中断而只看到部分问题
next 试探 GCC 16 / Clang 22,提前一个版本预警
strict-release 构建 Tongsuo、xquic、LuaJIT 依赖栈后编译发布特性集,
覆盖前三个 job 无法触达的模块
共享的 configure 调用抽到 .github/scripts/configure-warning-scan.sh,取仅
依赖 pcre2/zlib/openssl 的最大模块集合。strict-release 复用
packages/build/ 下已有的依赖构建脚本,因此校验的是发布配置本身。
build-deps.sh 新增 TENGINE_DEP_CFLAGS,仅追加到 Tongsuo 与 xquic 的构建,
默认为空以保证软件包产物不受影响。CI 传入 -std=gnu17 -Wno-error,使第三方
代码的方言差异与告警级别不与 Tengine 自身的 -Werror 混为一谈。
HTTP/2, XQUIC and Common: fix build failure with GCC 15 and add a compiler warning gate
strict-release 已在真实 runner 上首次跑绿,移除临时的 continue-on-error: true 及其说明注释,正式升级为阻塞式检查;inventory 与 next 的非阻塞属设计保留,未受影响。
ci.yml 中一处 TODO 注释顶格写在 run: | 块外,缩进不规范;对齐到与 step 列表项同级的 5 空格。注释内容不变,纯格式修正。
CI: promote strict-release to a blocking check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.