summaryrefslogtreecommitdiff
path: root/remote-curl.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2019-02-06 19:18:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-02-06 20:20:22 (GMT)
commitcbdb8d14392690f2e540b9efdb245871a043eb06 (patch)
tree609be1ffc8bd2f7c08727ec9ed8767fec909f7c5 /remote-curl.c
parent8ee3e120cd167dcfd2b7399cce567c724dfef134 (diff)
downloadgit-cbdb8d14392690f2e540b9efdb245871a043eb06.zip
git-cbdb8d14392690f2e540b9efdb245871a043eb06.tar.gz
git-cbdb8d14392690f2e540b9efdb245871a043eb06.tar.bz2
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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote-curl.c')
-rw-r--r--remote-curl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/remote-curl.c b/remote-curl.c
index c78ba83..bb74210 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -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.