Act nowcan affect a running systemAll 21 non-merge commits are covered; eight merge commits need no separate entries. The raw payload contains no superseded_by data, so upgrade.still_moving is empty and no later successor outside this edition is claimed. Version include bookkeeping was ignored. The full mormot.net.tunnel source was inspected at a2b3264ba074a4a87c675e8b372ebad87b469e48 to confirm the OpenDirect and SendData contracts.
Async uploads stop growing without bound
This is a dense networking and concurrency edition. Async HTTP reads are now bounded before request processing, Digest authentication accepts valid empty parameters, and Date, delayed-response and thread-completion paths receive targeted fixes. Two network extractions also require uses-clause changes for peer-cache and Windows http.sys applications, while Delphi POSIX locking gains its non-recursive pthread implementation and an alignment follow-up.
TL;DR
- TPollAsyncSockets.ReadMaxBytes defaults to 1 MB, preventing fast or endless uploads from filling process memory before OnRead runs.
- THttpPeerCache moves to mormot.net.peercache, while THttpApiServer and THttpApiWebSocketServer move to mormot.net.server.win; direct users must update uses clauses.
- Digest challenges with an empty optional value such as opaque="" now produce an Authorization header instead of remaining in a 401 loop.
- Delphi POSIX TOSLightLock now uses a non-recursive pthread mutex and should be taken with the pointer-alignment follow-up.
- Async Date generation, delayed AsyncResponse handling and TLoggedThread.WaitFinished each receive focused correctness fixes.
Upgrade advice
For this batch, land on merged head 751c1a03af59f7b3d9a2430f18f9e93d766592f5 at 2.4.17963. Do not take the mormot.net.server.win extraction without the later 9f810c80 conditional fix, and take the Delphi POSIX lock change together with c280a10c alignment. Update affected uses clauses, rebuild every Delphi/FPC target, and stress async uploads, Date headers and delayed responses.
21 of 21 entries · 29 commits upstream
1
High
Peer-cache types move out of mormot.net.server
The complete THttpPeerCache section, including THttpPeerCrypt and its initialization assertion, moves unchanged from mormot.net.server to the new mormot.net.peercache unit. Lazarus package metadata, the mormot2 umbrella unit, mget, tests and documentation now import or list the new unit.
Breaking changes
mormot.net.peercache+2
506dd5c2+2919-2833
net: new mormot.net.peercache unit extracted from mormot.net.server (#737)
Impact
Delphi and FPC application units that list only mormot.net.server and directly reference peer-cache declarations will stop compiling until mormot.net.peercache is added to uses. Code that imports the mormot2 umbrella unit receives it automatically. The move is described and shown as structural, with no peer protocol or cache behavior change.
Migration required
Search uses clauses and qualified references for THttpPeerCache and THttpPeerCrypt. Add mormot.net.peercache to every affected unit, then rebuild Delphi, FPC and Lazarus package targets.
Public API
THttpPeerCacheremoved — The type is no longer declared by mormot.net.server; it is declared by mormot.net.peercache.THttpPeerCryptremoved — The peer-cache frame type moves with THttpPeerCache to mormot.net.peercache.
2
High
Windows http.sys servers move to mormot.net.server.win
The THttpApiServer and THttpApiWebSocketServer interface and implementation sections move from mormot.net.server to the new mormot.net.server.win unit. Framework consumers, package metadata, tests and documentation add the new unit. Request code reaches the same server instance through the existing api field instead of the former cross-unit protected access.
Breaking changes
mormot.net.server+3
653e2fd8+2611-2524
net: new mormot.net.server.win unit extracted from mormot.net.server (#737)
Impact
Windows Delphi and FPC code that imports only mormot.net.server for http.sys classes will fail to compile until mormot.net.server.win is added. POSIX builds see a void unit. Runtime http.sys behavior is intended to remain unchanged, but the later conditional fix in 9f810c80e2c6e17a165423a5c57e5ad96090fdeb belongs with this extraction.
Migration required
Search for THttpApiServer, THttpApiWebSocketServer and mormot.net.server in application uses clauses. Add mormot.net.server.win on Windows http.sys paths and take the later 9f810c80 conditional correction before rebuilding.
Public API
THttpApiServerremoved — The public type moves from mormot.net.server to mormot.net.server.win.THttpApiWebSocketServerremoved — The public type moves from mormot.net.server to mormot.net.server.win.
3
High
Async reads are capped before request processing
TPollAsyncSockets gains the public ReadMaxBytes property, initialized to 1 MB. ProcessRead now stops its recv loop when the next 32 KB block would cross that limit, calls OnRead, and leaves remaining input in the socket buffer for the next notification. A regression test streams a 16 MB HTTP body and checks the largest block delivered to the download stream.
Fixes
mormot.net.async
57ff422a+114-2
net: TPollAsyncSockets.ProcessRead() won't buffer more than ReadMaxBytes
Impact
Fast clients can no longer make an async HTTP connection accumulate an entire large or endless body before OnBodyDownload and MaximumAllowedContentLength run. The upstream measurements drop a 300 MB upload from 562 MB peak RSS to about 8 MB. Delphi and FPC servers inherit the 1 MB default; applications can tune ReadMaxBytes if their latency and throughput profile needs another block size.
Upgrade recommended
Take this fix for THttpAsyncServer deployments that accept large or untrusted request bodies. Exercise streaming uploads and any custom TPollAsyncSockets.ReadMaxBytes value under both socket polling and IOCP targets.
Public API
TPollAsyncSockets.ReadMaxBytesadded — Sets the maximum bytes buffered by ProcessRead between OnRead calls; the default is 1 MB.
Units
4
High
http.sys extraction now follows the right feature flag
mormot.net.server.win now wraps its content with USEHTTPSYS instead of USEWININET and supplies a valid empty implementation otherwise. Stale WinHTTP imports are removed from mormot.net.server and mormot.net.peercache. Tests switch their http.sys uses and methods to USEHTTPSYS while keeping USEWININET only where the WinHTTP client is required.
Fixes
mormot.net.server.win+2
9f810c80+25-27
net: fixed USEHTTPSYS / USEWININET conditional usage
Impact
Builds whose WinHTTP client and http.sys server selections differ no longer expose or hide the new Windows server unit under the wrong define. This is especially relevant after the unit extraction: without it, valid Windows configurations could compile the wrong surface or fail. POSIX remains a void-unit path.
Upgrade recommended
Do not adopt the mormot.net.server.win extraction without this commit. Rebuild configurations with USEHTTPSYS enabled, disabled, and combined with USEWININET.
5
High
Digest authentication accepts empty quoted parameters
TDigestProcess.Parse no longer rejects an empty value returned by GetNextItem, so valid fields such as opaque="" remain in the parsed challenge. DigestServerAuth still rejects empty mandatory client fields. Regression tests use two real IP-camera challenge layouts and verify the generated RFC 7616 response digest.
Fixes
mormot.crypt.secure
d5b3c601+44-3
crypt: TDigestProcess.Parse() accepts a void parameter value
Impact
THttpClientSocket.AuthorizeDigest can now send an Authorization header to devices that advertise an empty optional Digest parameter, instead of returning an empty result and remaining in a 401 loop. Existing server-side validation of mandatory fields is unchanged. The behavior applies to Delphi and FPC clients.
Upgrade recommended
Take the fix when using Digest authentication with cameras or embedded HTTP devices. Retest challenges containing opaque="" and confirm the generated Authorization header against the device.
Public API
TDigestProcess.Parsebehaviour-changed — An empty quoted auth-param is accepted; mandatory field checks remain in DigestServerAuth.
Units
6
High
Async Date headers are protected from concurrent updates
THttpAsyncServer adds fHttpDateNowUtcSafe. IdleEverySecond locks while replacing the cached fHttpDateNowUtc buffer, and AppendHttpDate takes the same lock while appending it to a response.
Fixes
mormot.net.async
4624eda3+7-2
net: fixed THttpAsyncServer.AppendHttpDate potential race
Impact
Concurrent async responses can no longer read the cached Date header while the idle thread rewrites it. This removes the reported race and the possibility of a torn or inconsistent HTTP Date line. Application APIs and both Delphi/FPC call sites remain unchanged.
Upgrade recommended
Take this fix for concurrent THttpAsyncServer deployments, especially when hsoIncludeDateHeader is enabled. Stress parallel responses across second boundaries.
Units
7
Medium
HttpDateNowUtc initializes its cache before first use
HttpDateNowUtc now initializes the shared Value buffer under its lock when Value[0] is zero. Later refreshes compute a temporary value outside the lock and publish it only if the cached tick still matches, preventing obsolete calculations from overwriting newer data.
Fixes
mormot.core.datetime
7ba6029d+21-9
core: fixed HttpDateNowUtc() potential void value at startup
Impact
The first call at process startup no longer risks returning an empty HTTP Date value, and concurrent refreshes cannot publish an older computation over a newer tick. Existing Delphi and FPC code keeps the same HttpDateNowUtc signature.
Upgrade recommended
Take the fix for servers that emit Date headers during startup. Add a cold-start request test if your health checks depend on the first response.
Public API
HttpDateNowUtcbehaviour-changed — The cache is guaranteed to be initialized on the first call.
Units
8
Medium
Delayed async responses no longer pre-close on request flags
THttpAsyncServer.AsyncResponse removes its local response-state selection and always calls c.DoResponse with soContinue. It no longer passes soClose merely because hfConnectionClose was present in the parsed request; DoResponse may still return soClose and trigger the existing close path.
Fixes
mormot.net.async
18fb44d1+3-8
net: fixed THttpAsyncServer.AsyncResponse
Impact
Applications using delayed THttpAsyncServer.AsyncResponse avoid the reported premature close behavior tied to the request's Connection flag. Connection closure still follows DoResponse's result, so the change is confined to the asynchronous response path and requires no source migration.
Upgrade recommended
Take the fix if AsyncResponse serves deferred work. Retest keep-alive and Connection: close requests whose response is completed from another thread.
Public API
THttpAsyncServer.AsyncResponsebehaviour-changed — The method enters DoResponse with soContinue regardless of hfConnectionClose.
Units
9
Medium
Delphi POSIX pthread storage gains pointer alignment
TPosixLightMutex changes from a 64-byte array to a record containing a pointer followed by seven PtrUInt values. The size remains sufficient for pthread_mutex_t while the record now carries pointer alignment.
Fixes
mormot.core.os
c280a10c+7-3
core: ensure TPosixLightMutex is pointer-aligned on Delphi POSIX
Impact
The direct pthread mutex introduced for Delphi POSIX is no longer placed in byte-aligned storage. This is a correctness follow-up for Linux and Darwin targets; Windows and FPC layouts are unaffected, and application source does not change.
Upgrade recommended
Take this commit together with d8a8b965 on every Delphi POSIX target using TOSLightLock, then run lock and contention tests.
Units
10
Medium
WaitFinished reports threads that already stopped
TLoggedThread.WaitFinished now exits only for a nil instance, initializes Result to not fProcessing, and returns immediately when processing has already ended. The waiting path and timeout normalization remain unchanged.
Fixes
mormot.core.threads
570c08a6+6-4
core: fixed TLoggedThread.WaitFinished
Impact
Callers no longer receive false when they ask about a TLoggedThread that is already finished. Delphi and FPC code using the Boolean result for shutdown or cleanup can now distinguish successful prior completion without another wait.
Upgrade recommended
Take the fix if shutdown logic branches on WaitFinished. Add a test that calls WaitFinished after fProcessing has already become false.
Public API
TLoggedThread.WaitFinishedbehaviour-changed — Returns true when the thread was already not processing.
Units
11
Medium
Encrypted tunnels can connect directly in process
TTunnelLocal adds OpenDirect to perform the existing authenticated encrypted handshake while delivering plaintext to an in-process ITunnelTransmit instead of a local TCP socket. SendData accepts plaintext from that endpoint, preserves the 64 KB payload limit, serializes outbound frames and keeps AES-GCM IV order. Crypto state moves from TTunnelLocalThread to TTunnelLocal so socket and direct transports share the same path.
New features
mormot.net.tunnel+1
a2b3264b+290-125
net: new TTunnelLocal.OpenDirect() method
Impact
A backend can connect an in-process KVM or stand-alone VNC component to the tunnel without allocating a local listening port. Existing Open and OpenSocket callers keep their signatures, but their internal encryption ownership is refactored; the separate regression-test commit exercises direct bidirectional binary frames.
Worth a look
If adopting OpenDirect, provide live Transmit and LocalTransmit implementations, keep each SendData payload at or below 64 KB, and test handshake failure, closure and bidirectional ordering.
Public API
TTunnelLocal.OpenDirectadded — Opens a portless authenticated tunnel to an in-process ITunnelTransmit.TTunnelLocal.SendDataadded — Sends up to 64 KB of plaintext through the direct or socket-backed tunnel.
12
Medium
Delphi POSIX light locks become truly non-recursive
On Delphi POSIX, TOSLightLock replaces the TRTLCriticalSection/TMonitor fallback with direct pthread_mutex_init, lock, trylock, unlock and destroy calls using default non-recursive attributes. The opaque TPosixLightMutex storage is sized for Linux and Darwin pthread_mutex_t, and the methods are not inlined because Posix.Pthread remains implementation-only.
Compiler & platform
mormot.core.os+1
d8a8b965+57-6
core: TOSLightLock is a non-recursive pthread mutex on Delphi POSIX
Impact
TryLock from the owning thread now fails and a nested Lock can deadlock, matching the documented TOSLightLock contract and other targets. Windows and FPC are unchanged. Delphi Linux, macOS, Android and iOS code that accidentally relied on recursive behavior needs review, and the later alignment follow-up c280a10c6f05071273a741ae3e7f134860dcadab should be taken with this change.
Worth a look
Audit Delphi POSIX paths for recursive TOSLightLock acquisition or a second TryLock by the owning thread, then test with the alignment follow-up c280a10c.
Public API
TOSLightLockbehaviour-changed — Delphi POSIX now enforces the documented non-recursive semantics.
13
Medium
Socket HTTP servers ignore suffix-only byte ranges
THttpRequestContext.ParseHeader now recognizes a Range only when bytes= is followed by a positive numeric offset. Forms such as bytes=100-200 and bytes=100- remain supported. A suffix-only form such as bytes=-10 no longer sets rfWantRange and falls through to a normal full response.
Compiler & platform
mormot.net.http
54411993+27-24
net: range: bytes=-10 fallback to 200 and the whole content
Impact
Socket-based HTTP servers now match the existing http.sys fallback for suffix ranges by returning status 200 with the whole content instead of treating the suffix as a range. Clients that depend on RFC suffix-range behavior will receive more data and must not assume a 206 response. Delphi and FPC server APIs are unchanged.
Worth a look
Check clients or media downloaders that send suffix-only Range headers. If partial tails are required, issue an explicit start offset or handle the full 200 response.
Units
14
Low
Binary test constants become code-page independent
The Baudot decode table in mormot.core.buffers and the BSON reference bytes in test.core.data are rewritten as hexadecimal strings decoded with HexToBin. This avoids Delphi interpreting concatenated #nnn character escapes through a DBCS host code page.
Compiler & platform
mormot.core.buffers
2b487195+21-15
core: Baudot2Char and BSONAWESOMEBIN as hexadecimal constants decoded by HexToBin()
Impact
Baudot and BSON expected bytes remain identical, but Delphi builds on DBCS systems no longer depend on source-literal decoding. FPC and non-DBCS builds see no functional change.
Units
15
Low
Direct tunnels gain bidirectional regression coverage
test.net.proto adds an in-process ITunnelTransmit receiver and a TunnelDirect scenario. It opens paired client/server direct tunnels, checks that no worker thread or port is used, sends binary frames in both directions, validates the frame counters and exercises shutdown.
Tests
05fed0b1+122-12
test: include TTunnelLocal.OpenDirect() regression tests
Impact
No application code changes. The tests document and protect the new portless tunnel behavior for Delphi and FPC builds.
16
Low
POSIX numeric tests compare doubles by ULP distance
test.core.base adds SameWithin2Ulps and uses it for pure Pascal floating-point parsing paths. Exact bit comparisons remain for the x86-64 assembler path without FP80, while the fallback now accepts a difference of at most two ULPs.
Tests
b5c58707+32-6
tests: fixed double text expectations on Delphi POSIX
Impact
No production behavior changes. Delphi POSIX and other pure-Pascal test runs avoid false failures caused by tiny double-rounding differences.
17
Low
CheckMatchAny failures now include their value
TSynTestCase.CheckMatchAny replaces a bare Check(result) with CheckUtf8(result, '%=%', [msg, Value]). The same Boolean match is evaluated, but a failure now reports the caller message and actual RawUtf8 value. The commit also refreshes changelog wording.
Tests
mormot.core.test
4475ffd8+7-6
core: fixed TSynTestCase.CheckMatchAny
Impact
No backend behavior changes. Delphi and FPC test failures become easier to diagnose without changing match semantics.
Units
18
Low
PDF font tests accept an extra Windows LUTI table
The reduced-font test now accepts search fields for either nine tables or ten tables. This covers Windows font versions that include LUTI and stores the inspected bytes in a RawUtf8 value before CheckMatchAny.
Tests
4b742162+6-3
test: handle pdf fonts included in LUTI Windows versions
Impact
No PDF generation behavior changes. Test suites no longer reject a valid Windows font layout solely because LUTI adds one table.
19
Low
Tunnel test literals avoid Delphi compilation hints
Two binary TunnelDirect test payloads are built with HexToBin instead of mixed text and numeric character literals. The bytes remain video plus 00 80 FF and key plus 00 01 1B.
Tests
fd983d13+4-4
test: fixed Delphi compilation hints
Impact
No application or protocol behavior changes. Delphi test compilation is quieter while the same binary frames are exercised.
20
Low
Crypto factory documentation names the new uses requirement
CHANGELOG.md and SAD chapter 3 now list mormot.crypt.factory, distinguish it from mormot.crypt.secure and show both units in the high-level factory example. The changelog names the moved Rnd, Hash, Sign, Cipher, Asym, Cert, Store, ICryptCert and ICryptStore declarations.
Docs
d73d6142+7-4
docs: mention the mormot.crypt.factory extraction in CHANGELOG and SAD chapter 3
Impact
No code changes. Delphi and FPC developers receive an explicit migration reference for the source-level unit move published in the previous edition.
21
Low
Network documentation clarifies feature flags and read limits
The network README corrects the void-unit condition for mormot.net.server.win from USEWININET to USEHTTPSYS and adds THttpProxyServer to the async-unit inventory. A source comment records the 1 MB default purpose of fReadMaxBytes.
Docs
mormot.net.async
0cbde657+5-4
core: mostly comments/documentations precisions
Impact
No runtime or application-code change. The documentation now matches the conditional fix and the bounded-read default.