Skip to content

Commit cbdb8d1

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". We check that with starts_with(), but really that should be the only thing in that packet. A response of "version 20" should not match. 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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8ee3e12 commit cbdb8d1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

remote-curl.c

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

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

0 commit comments

Comments
 (0)