upload-pack: only accept packfile-uris if we advertised it
commita922bfa3b5a6b2ac5e98f0e3405d66c1847aa7e8
authorJeff King <peff@peff.net>
Wed, 28 Feb 2024 22:50:50 +0000 (28 17:50 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 29 Feb 2024 16:10:42 +0000 (29 08:10 -0800)
treed494eb2b5d80e3d26de8afd813b5780464c89019
parent9a7b22959ad078df1f50d15e86a169aaebfb8c4c
upload-pack: only accept packfile-uris if we advertised it

Clients are only supposed to request particular capabilities or features
if the server advertised them. For the "packfile-uris" feature, we only
advertise it if uploadpack.blobpacfileuri is set, but we always accept a
request from the client regardless.

In practice this doesn't really hurt anything, as we'd pass the client's
protocol list on to pack-objects, which ends up ignoring it. But we
should try to follow the protocol spec, and tightening this up may catch
buggy or misbehaving clients more easily.

Thanks to recent refactoring, we can hoist the config check from
upload_pack_advertise() into upload_pack_config(). Note the subtle
handling of a value-less bool (which does not count for triggering an
advertisement).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5702-protocol-v2.sh
upload-pack.c