mORMot2 Daily每日上游提交速读

SChannel 与 HTTP cache 稳定,但 heartbeat 出现回归

Windows SChannel 修复了并发、handshake、重协商与内存使用;HTTP client 新增可选 redirect 限制,两个 proxy cache 也修正状态处理。异步 WebSocket heartbeat 改由 HeartbeatDelay 驱动,但两次后续修改使最终 idle-loop 比较在达到默认内存释放阈值后禁用 callback。自定义 INetTls 实现及使用已移除 LastOperationIdleSeconds 属性的代码也需要迁移。

要点

  • 采用 upstream head c94dba6c18f6a0c5b225734af210da678cc59167,即 build 2.4.17161,以获得完整 SChannel、redirect 与 cache 修复。
  • 异步 WebSocket heartbeat callback 会在默认 idle-memory 阈值后被禁用;比较条件修复前请将 LastOperationReleaseMemorySeconds 设为 0。
  • 自定义 INetTls 实现必须添加 ReleaseBuffers,使用 LastOperationIdleSeconds 的代码须迁移到 GetLastOperationIdleSeconds。
  • THttpRequestExtendedOptions.RedirectOptions 新增可选 cross-origin credential 清理与 redirect 拒绝,默认仍不受限制。
  • Proxy cache 现在拒绝无效 GET 状态,失败时中止 progressive reader,并校验最终文件大小。
  • 避开 build 2.4.17143 以及未完成的 redirect build 2.4.17159–2.4.17160。

升级建议

采用 head c94dba6c18f6a0c5b225734af210da678cc59167 的 build 2.4.17161,以获得 SChannel、redirect 与 proxy-cache 修复。升级前为自定义 TLS backend 实现 INetTls.ReleaseBuffers,并替换 LastOperationIdleSeconds。异步 WebSocket server 应将 LastOperationReleaseMemorySeconds 设为 0,并在 cutoff 比较获得后续修复前测试 heartbeat 流量。

版本号2.4.17135 → 2.4.17161
提交22
行数+595 -335
阅读3 分钟

22 条中的 22 条 · 上游 22 次提交

主题
# 条目 类别 单元
1 高 WebSocket heartbeat 调度改用 HeartbeatDelay TAsyncConnections 移除 LastOperationIdleSeconds,新增 virtual GetLastOperationIdleSeconds。TWebSocketAsyncConnections override 后返回 Settings.HeartbeatDelay 秒数,0 禁用 ping/pong。 破坏性变更 mormot.net.async+1 efb27161+37-23

net: fixed WebSockets HeartbeatDelay async server support

影响

赋值 LastOperationIdleSeconds 的代码将无法编译。WebSocket server 改从 settings 获取间隔,但后续 commit 回归 cutoff,最终 head 需使用 workaround。

需要迁移

搜索 LastOperationIdleSeconds。WebSocket 使用 TWebSocketProtocol.Settings.HeartbeatDelay,其他 TAsyncConnections descendant override GetLastOperationIdleSeconds。

公开 API

  • TAsyncConnections.LastOperationIdleSecondsremoved — 可写 property 被 virtual getter 取代。
  • TAsyncConnections.GetLastOperationIdleSecondsadded — 默认返回 0,可由 descendant override。

Arnaud Bouchez · 12:52 UTC · 在 GitHub 上查看该提交 →

2 高 INetTls 新增空闲 buffer 释放契约 公共 INetTls interface 新增 ReleaseBuffers: PtrInt。TSChannelNetTls 释放空 input/data/output buffer;TOpenSslNetTls 返回 0,因为 SSL_MODE_RELEASE_BUFFERS 已启用且 SSL_free_buffers 不安全。 破坏性变更 mormot.lib.openssl11+2 ef8aa8a5+31-2

net: introducing INetTls.ReleaseBuffers method

影响

任何外部 INetTls 实现都会在添加新方法前编译失败;内置 OpenSSL 与 SChannel 实现已完整。

需要迁移

搜索实现 INetTls 的 class,添加 function ReleaseBuffers: PtrInt;backend 无安全显式释放操作时返回 0。

公开 API

  • INetTls.ReleaseBuffersadded — 必需方法,返回已知释放字节数。

Arnaud Bouchez · 10:37 UTC · 在 GitHub 上查看该提交 →

3 高 并发 SChannel send 与重协商现被串行化 TSChannelNetTls 在 Receive 处理 SEC_I_RENEGOTIATE 与 Send 加密周围新增 fSspiSafe;Receive 持 lock 时 Send 返回 nrRetry,避免 WebSocket 读写同时使用 SSPI context。 修复 mormot.net.sock.windows 3e2819e1+95-63

net: hardened TSChannelNetTls thread safety

影响

TLS 1.3 post-handshake 数据在 send 期间到达时,Windows WebSocket connection 不再并发竞用 SSPI;已处理 nrRetry 的 caller 无需改源码。

Arnaud Bouchez · 07:00 UTC · 在 GitHub 上查看该提交 →

4 高 失败的 proxy download 现中止 reader 并删除 partial file Proxy cache 仅接受 GET 的 200/204/206,记录 expected size,在建立或后台失败时中止所有 THttpPartial reader,并删除 status/size 不匹配的 incomplete file。 修复 mormot.net.async e3a44702+51-11

net: fixed Proxy Cache process

影响

Progressive client 不再等待失败的 origin transfer,也不会将截断 cache object 当作完整内容;redirect/error body 不再作为成功资源存储。

Arnaud Bouchez · 15:46 UTC · 在 GitHub 上查看该提交 →

5 高 分段 ClientHello 不再重启 SChannel accept TSChannelNetTls 跟踪 fAcceptFirst;AcceptSecurityContext 返回 SEC_I_CONTINUE_NEEDED 后复用现有 SSPI context,不再将不完整首个 ClientHello 当作新协商。 修复 mormot.net.sock.windows 7f17ffe4+12-4

net: fixed SChannel partial initial negotiation

影响

ClientHello 分多个 TCP read 到达时,SChannel server 可完成 handshake,不再失败或破坏协商 context。

Arnaud Bouchez · 07:09 UTC · 在 GitHub 上查看该提交 →

6 高 HEAD redirect 已修复,但 heartbeat cutoff 仍错误 THttpClientSocket 在 301/303 上保留 HEAD/OPTIONS,并将带 body 的方法改为 GET。同一 commit 将 async idle guard 改为 allowed < gc;gc 变为绝对 60 秒内存 cutoff 后,该条件把 allowed 置零并跳过 heartbeat callback。 修复 mormot.net.async+1 edf01585+5-4

net: THttpClientSocket should keep HEAD for HTTP_MOVEDPERMANENTLY

影响

HEAD 请求现保留 redirect 方法语义。默认 LastOperationReleaseMemorySeconds=60 时,async WebSocket server 超过该阈值后停止调度 OnLastOperationIdle;设为 0 可避开此分支。

值得一看

测试 HEAD redirect。对 async WebSocket server,将 LastOperationReleaseMemorySeconds 设为 0,并在 upstream 修复 cutoff 比较前验证 ping/pong 流量。

公开 API

  • THttpClientSocket.Request redirect handlingbehaviour-changed — 301/303 保留 HEAD、OPTIONS 等无 body 方法。

Arnaud Bouchez · 13:35 UTC · 在 GitHub 上查看该提交 →

7 高 Same-origin redirect 现会发送新的 path THttpClientSocket.Request 将 ctxt.Url 赋值移出仅重连 block,因此 host、port、TLS 不变时的 redirect 也会更新下一次请求 URL。 修复 mormot.net.client 30f397da+3-3

net: fixed THttpClientSocket redirections on the same server

影响

复用 socket 时,same-server redirect 不再重复原 path 或返回错误资源。

Arnaud Bouchez · 13:40 UTC · 在 GitHub 上查看该提交 →

8 高 SChannel 重协商再次保留已解密 buffer TSChannelNetTls.Receive 的 SEC_I_RENEGOTIATE 分支现先调用 ProcessBuffers,再检查 pending output 并继续 TLS 1.3 post-handshake。 修复 mormot.net.sock.windows c6dc158f+3-2

net: fixed previous commit

影响

Build 2.4.17143 可能丢失或不暴露重协商同时到达的解密数据;2.4.17144 恢复处理。

Arnaud Bouchez · 07:42 UTC · 在 GitHub 上查看该提交 →

9 高 Idle-loop 清理引入 heartbeat cutoff 回归 TAsyncConnections.IdleEverySecond 新增 underflow guard 与 shutdown check,但 heartbeat guard 将 sec 与已转换的 gc 比较,而非 heartbeat delay;下一 commit 更换 operand 仍未恢复正确 cutoff。 内部重构 mormot.net.async fab1dd9a+18-15

net: minor TAsyncConnections.IdleEverySecond cleanup

影响

该清理启动了最终 head 中抑制 async WebSocket idle callback 的条件;除此之外,非 WebSocket idle cleanup 的终止检查更安全。

值得一看

不要依赖此中间 heartbeat 逻辑;应用最终 head 所述 LastOperationReleaseMemorySeconds workaround。

Arnaud Bouchez · 13:02 UTC · 在 GitHub 上查看该提交 →

10 中 Proxy HEAD 探测现保留 204 与 redirect 结果 RemoteClientHead 仅对无长度的 200 使用 Range GET fallback,直接返回 204/3xx,并将 TSimpleHttpClient.RequestContext 加入异常诊断。 修复 mormot.net.async+1 48940904+15-12

net: enhanced THttpProxyUrl.RemoteClientHead

影响

有意返回 no-content 或 redirect 的 origin 不再被 Range probe 替换,proxy log 也包含诊断所需 redirect/socket context。

Arnaud Bouchez · 13:57 UTC · 在 GitHub 上查看该提交 →

11 中 Redirect credential 清理现覆盖自动生成的 Referer THttpClientSocket 改用 fAuthPurge,在 cross-origin 清理后抑制自动生成的 Referer 与 Authorization,并用 TUri.Same 比较 origin。 修复 mormot.net.client c94dba6c+11-11

net: some THttpRedirectOptions fixes

影响

启用 hroPurgeReferer 或 hroPurgeAuthorization 后,socket field 不再在 redirect 请求中重新泄漏这些值;默认行为不变。

Arnaud Bouchez · 17:35 UTC · 在 GitHub 上查看该提交 →

12 中 Proxy HEAD/GET 路径现保留非文件状态码 THttpProxyServer 将本地文件与 progressive output 限于 HTTP_GET_OK,对其他已知 size 状态单独输出 Content-Length,并提前复制 option。 修复 mormot.net.async 597eea16+9-5

net: fixed THttpProxyServer HEAD/GET response codes

影响

HEAD/GET caller 会收到 origin 状态,而不会让 redirect 或其他 response 进入文件传输逻辑。

Arnaud Bouchez · 16:20 UTC · 在 GitHub 上查看该提交 →

13 中 Proxy cache 的 204 response 不再进入文件传输 THttpProxyServer 将 size 与 progressive-file 处理限定为 HTTP 200/206,排除 204,同时保留 redirect response 及 header。 修复 mormot.net.async 882e3435+7-5

net: fixed 204 responses for the Proxy Cache

影响

无内容的 origin response 会保持为 204,不再作为长度无效或伪造的可下载文件处理。

Arnaud Bouchez · 17:31 UTC · 在 GitHub 上查看该提交 →

14 中 Range 探测现规范化 206 且不拒绝 redirect RemoteClientHead 将 Range GET 产生的 206 映射回 200;MakeHeadAndComputeFilename 仅对实际 200/206 download 要求 size,并允许 3xx 透传。 修复 mormot.net.async b98df07d+8-3

net: fixed some other Proxy Cache status issues

影响

通过 Range 探测的动态资源不再经 proxy 暴露误导性 206;无 Content-Length 的 redirect 也不再被转为错误。

Arnaud Bouchez · 16:27 UTC · 在 GitHub 上查看该提交 →

15 中 Peer cache redirect 现保留 Location header THttpPeerCache.DirectFileNameHead 在检查 HTTP_GET_OK 前将 client response header 赋给 Ctxt.OutCustomHeaders,因此 3xx 也保留 Location。 修复 mormot.net.server 9b96345d+3-3

net: fixed THttpPeerCache to include Location: for 3xx redirections

影响

Client 可跟随 THttpPeerCache 返回的 redirect,不再收到缺少目标 URL 的 3xx。

Arnaud Bouchez · 14:12 UTC · 在 GitHub 上查看该提交 →

16 中 HTTP client 新增可选 redirect 安全 policy mormot.net.client 新增 THttpRedirectOption、THttpRedirectOptions 与 RedirectOptions,可跨 origin 清理 Authorization/Cookie/Referer,并拒绝 downgrade、cross-origin 或 userinfo redirect。 新功能 mormot.net.client 492aeccf+95-18

net: new THttpRedirectOptions set of options for THttpClientSocket

影响

默认空集合保持原有 unrestricted redirect。安全敏感 caller 可在不替换 redirect loop 的情况下阻止 credential 转发或不安全目的地变化。

值得一看

检查会跟随不可信 redirect 的 client,选择所需 hroPurge*/hroReject* flag,并包含 build 2.4.17161 修复。

公开 API

  • THttpRedirectOptionadded — 新增六种清理与拒绝选项。
  • THttpRedirectOptionsadded — THttpRedirectOption 的集合。
  • THttpRequestExtendedOptions.RedirectOptionsadded — 默认为空集合,目前由 THttpClientSocket 实现。

Arnaud Bouchez · 17:29 UTC · 在 GitHub 上查看该提交 →

17 中 SChannel buffer 改用 SSPI 限制而非固定增长 TSChannelNetTls 记录精确最大 TLS record size,output 从 2 KB 开始,并按 SECBUFFER_MISSING 数量增长 input,最高到 SSPI 上限。 性能 mormot.lib.sspi+1 8bcdf6c9+39-13

net: refined SChannel TLS buffer size

影响

典型 Windows TLS connection 占用更少内存,大 record 仍可增长至 SChannel 所需大小;应用行为不变。

Arnaud Bouchez · 10:31 UTC · 在 GitHub 上查看该提交 →

18 中 SChannel receive 处理围绕 SSPI 结果集中化 TSChannelNetTls.Receive 将 buffer 提取集中到 ProcessBuffers,并在一个结果 switch 中处理 SEC_E_OK、SEC_I_RENEGOTIATE、context expiry 与错误;SQLite/changelog 仅改文字。 内部重构 mormot.net.sock.windows+1 1ebf95e7+53-46

net: rewritten TSChannelNetTls.Receive core process

影响

Receive 路径更易推理并正确协调重协商 lock,但此精确 build 需要下一 commit 的 ProcessBuffers 修复;数据库行为不变。

值得一看

不要停在 build 2.4.17143;应包含 c6dc158f3a9e1be0dd9a06e063800365f9d4bf45 或更新版本。

Arnaud Bouchez · 07:39 UTC · 在 GitHub 上查看该提交 →

19 低 SChannel connection 改用较小动态初始 buffer 移除固定 19 KB TLSRECMAXSIZE allocation;TSChannelNetTls 的 input/data/output 从 4 KB 开始,并随 record 通过 EnsureLength 增长。 性能 mormot.net.sock.windows f1785ad1+40-42

net: reduce TSChannelNetTls memory consumption per connection

影响

大量 mostly-idle TLS connection 的 Windows service 可降低基础内存占用;大传输仍按需分配。

Arnaud Bouchez · 09:00 UTC · 在 GitHub 上查看该提交 →

20 低 空闲 async connection 仅释放一次工作内存 TPollAsyncConnection.ReleaseMemoryOnIdle 在正确 lock 下统一 read/write/TLS 清理,成功后标记 fMemClean,新活动再清除,避免每秒重复尝试。 性能 mormot.net.async 85f08e29+32-39

net: rewritten TPollAsyncConnection.ReleaseMemoryOnIdle

影响

长期空闲 server 每秒减少 lock 与 cleanup 工作,同时仍在活动停止后释放 per-connection buffer;应用代码不变。

Arnaud Bouchez · 12:15 UTC · 在 GitHub 上查看该提交 →

21 低 空闲 async socket 现释放 SChannel buffer TPollAsyncConnection.ReleaseMemoryOnIdle 按要求获取 read/write lock,在无 pending plain data 时调用 INetTls.ReleaseBuffers。 性能 mormot.net.async a03577b9+23-4

net: idle TPollAsyncConnection release its INetTls buffers

影响

Windows SChannel server 可回收空闲 connection 的 TLS allocation;OpenSSL 因 release mode 已安全处理而保持 no-op。

Arnaud Bouchez · 10:43 UTC · 在 GitHub 上查看该提交 →

22 低 SChannel 重协商改用 Windows OS lock TSChannelNetTls 在 Receive/Send SSPI 重协商边界用 TOSLightLock 取代 TLightLock,并移除冗余 first-accept 状态赋值。 性能 mormot.core.os+1 ef2fdc14+5-7

net: some TSChannelNetTls cleanup/optimization

影响

Sender 释放 lock 时,被阻塞的 Windows receiver 可更快调度;应用 API 与非 Windows backend 不变。

Arnaud Bouchez · 07:17 UTC · 在 GitHub 上查看该提交 →

上游活动 每日提交数 · 最近 60 天
提交977
活跃天数44/60
最忙一天2026-09-30
峰值60
2026-08-15: 0 commits2026-08-16: 0 commits2026-08-17: 0 commits2026-08-18: 0 commits2026-08-19: 0 commits2026-08-20: 0 commits2026-08-21: 0 commits2026-08-22: 0 commits2026-08-23: 0 commits2026-08-24: 0 commits2026-08-25: 0 commits2026-08-26: 0 commits2026-08-27: 26 commits2026-08-28: 11 commits2026-08-29: 10 commits2026-08-30: 1 commit2026-08-31: 23 commits2026-09-01: 0 commits2026-09-02: 20 commits2026-09-03: 29 commits2026-09-04: 35 commits2026-09-05: 13 commits2026-09-06: 0 commits2026-09-07: 0 commits2026-09-08: 23 commits2026-09-09: 10 commits2026-09-10: 17 commits2026-09-11: 23 commits2026-09-12: 14 commits2026-09-13: 9 commits2026-09-14: 7 commits2026-09-15: 4 commits2026-09-16: 24 commits2026-09-17: 26 commits2026-09-18: 21 commits2026-09-19: 59 commits2026-09-20: 13 commits2026-09-21: 5 commits2026-09-22: 34 commits2026-09-23: 17 commits2026-09-24: 57 commits2026-09-25: 22 commits2026-09-26: 26 commits2026-09-27: 0 commits2026-09-28: 2 commits2026-09-29: 19 commits2026-09-30: 60 commits2026-10-01: 26 commits2026-10-02: 30 commits2026-10-03: 32 commits2026-10-04: 15 commits2026-10-05: 1 commit2026-10-06: 26 commits2026-10-07: 37 commits2026-10-08: 27 commits2026-10-09: 35 commits2026-10-10: 33 commits2026-10-11: 9 commits2026-10-12: 11 commits2026-10-13: 35 commits
2026-08-152026-10-13