summaryrefslogtreecommitdiff
path: root/protocol-caps.c
AgeCommit message (Collapse)AuthorFilesLines
2021-09-20Merge branch 'ab/serve-cleanup'Libravatar Junio C Hamano1-2/+1
Code clean-up around "git serve". * ab/serve-cleanup: upload-pack: document and rename --advertise-refs serve.[ch]: remove "serve_options", split up --advertise-refs code {upload,receive}-pack tests: add --advertise-refs tests serve.c: move version line to advertise_capabilities() serve: move transfer.advertiseSID check into session_id_advertise() serve.[ch]: don't pass "struct strvec *keys" to commands serve: use designated initializers transport: use designated initializers transport: rename "fetch" in transport_vtable to "fetch_refs" serve: mark has_capability() as static
2021-08-31protocol-caps.c: fix memory leak in send_info()Libravatar Ævar Arnfjörð Bjarmason1-2/+3
Fix a memory leak in a2ba162cda (object-info: support for retrieving object info, 2021-04-20) which appears to have been based on a misunderstanding of how the pkt-line.c API works. There is no need to strdup() input to packet_writer_write(), it's just a printf()-like format function. This fixes a potentially large memory leak, since the number of OID lines the "object-info" call can be arbitrarily large (or a small one if the request is small). This makes t5701-git-serve.sh pass again under SANITIZE=leak, as it did before a2ba162cda2. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Acked-by: Bruno Albuquerque <bga@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-08-05serve.[ch]: don't pass "struct strvec *keys" to commandsLibravatar Ævar Arnfjörð Bjarmason1-2/+1
The serve.c API added in ed10cb952d3 (serve: introduce git-serve, 2018-03-15) was passing in the raw capabilities "keys", but nothing downstream of it ever used them. Let's remove that code because it's not needed. If we do end up needing to pass information about the advertisement in the future it'll make more sense to have serve.c parse the capabilities keys and pass the result of its parsing, rather than expecting expecting its API users to parse the same keys again. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-04-20object-info: support for retrieving object infoLibravatar Bruno Albuquerque1-0/+113
Sometimes it is useful to get information of an object without having to download it completely. Add the "object-info" capability that lets the client ask for object-related information with their full hexadecimal object names. Only sizes are returned for now. Signed-off-by: Bruno Albuquerque <bga@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>