feat(codec): negotiate checksum/compression algorithms (protocol 2.26.0)
Accept the full rsync 3.4.1 --compress-choice set (zstd/lz4/zlib/zlibx/ none/auto) and the two-name --checksum-choice TRANSFER,PRE-TRANSFER form, including rsync's 'none' rules (rejected with --checksum at exit 4, and forcing --whole-file as the transfer half) and unknown names at exit 4. The checksum default becomes the auto-negotiated xxh128. Negotiation is deterministic and symmetric: both peers run the same preference resolver (rsync's --version order). The resolved compression_algo crosses the wire as a new trailing config-frame int so the receiver validates and installs the exact codec; an unsupported choice is refused before STATUS_OK like rsync's failed negotiation. Bump PROTOCOL_VERSION to 2.26.0.
This commit is contained in:
@@ -741,6 +741,10 @@ void handler(int file_descriptor) {
|
||||
* received config. */
|
||||
if (gate_ctx.super_mode_override != -1)
|
||||
config->super_mode = (SuperMode)gate_ctx.super_mode_override;
|
||||
/* Install the codec this connection negotiated before the receiver/writer
|
||||
* threads start (the server forks per connection, so the process-global
|
||||
* codec is private to this session). */
|
||||
compression_set_algo((CompressionAlgo)config->compression_algo);
|
||||
/* If the client requested ownership but the effective super mode forbids it
|
||||
* (operator --no-super, a privileged standalone receiver's secure default, or
|
||||
* a daemon module without `client owner = yes`), say so ONCE per connection so
|
||||
|
||||
Reference in New Issue
Block a user