upload-pack, serve: log received client session ID

When upload-pack (protocol v0/v1) or a protocol v2 server receives a
session-id capability from a client, log the received session ID via a
trace2 data event.

Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Josh Steadmon
2020-11-11 15:29:32 -08:00
committed by Junio C Hamano
parent 1e905bbc00
commit 829594677c
3 changed files with 24 additions and 6 deletions

View File

@ -201,6 +201,7 @@ static int process_request(void)
struct packet_reader reader;
struct strvec keys = STRVEC_INIT;
struct protocol_capability *command = NULL;
const char *client_sid;
packet_reader_init(&reader, 0, NULL, 0,
PACKET_READ_CHOMP_NEWLINE |
@ -264,6 +265,9 @@ static int process_request(void)
check_algorithm(the_repository, &keys);
if (has_capability(&keys, "session-id", &client_sid))
trace2_data_string("transfer", NULL, "client-sid", client_sid);
command->command(the_repository, &keys, &reader);
strvec_clear(&keys);