Skip to content

Commit 240fb9b

Browse files
peffgitster
authored andcommitted
remote-curl: tighten "version 2" check for smart-http
In a v2 smart-http conversation, the server should reply to our initial request with a pkt-line saying "version 2" (this is the start of the "capabilities advertisement"). We check for the string using starts_with(), but that's overly permissive (it would match "version 20", for example). Let's tighten this check to use strcmp(). Note that we don't need to worry about a trailing newline here, because the ptk-line code will have chomped it for us already. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 34a9469 commit 240fb9b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

remote-curl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ static void check_smart_http(struct discovery *d, const char *service,
375375
d->len = src_len;
376376
d->proto_git = 1;
377377

378-
} else if (starts_with(line, "version 2")) {
378+
} else if (!strcmp(line, "version 2")) {
379379
/*
380380
* v2 smart http; do not consume version packet, which will
381381
* be handled elsewhere.

0 commit comments

Comments
 (0)