提交 cbdb8d14 编写于 作者: J Jeff King 提交者: Junio C Hamano

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: NJeff King <peff@peff.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 8ee3e120
......@@ -374,7 +374,7 @@ static void check_smart_http(struct discovery *d, const char *service,
d->len = reader.src_len;
d->proto_git = 1;
} else if (starts_with(reader.line, "version 2")) {
} else if (!strcmp(reader.line, "version 2")) {
/*
* v2 smart http; do not consume version packet, which will
* be handled elsewhere.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册