git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: lilinchao@oschina.cn
To: git@vger.kernel.org
Cc: gitster@pobox.com, lilinchao <lilinchao@oschina.cn>
Subject: [PATCH 2/2] remote-curl.c: handle v1 when check_smart_http
Date: Wed, 24 Mar 2021 13:36:48 +0800	[thread overview]
Message-ID: <006547b28c6311eb93820024e87935e7@oschina.cn> (raw)
In-Reply-To: <20210324053648.25584-1-lilinchao@oschina.cn>

From: lilinchao <lilinchao@oschina.cn>

When clone with http protocol version 1, the server side
just tells client that "invalid server response, got version 1",
this is not clear enough, because version 0 is ok, and
version 2 is ok, then version 1 should be ok too intuitively,
but the other side just treat it as "invalid response", this
can't explain why is not ok.

>From receive-pack/upload-pack, there is a comment which I think,
can explain it:
"v1 is just the original protocol with a version string".
So I made this patch to try to fix it.

Signed-off-by: lilinchao <lilinchao@oschina.cn>
---
 remote-curl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/remote-curl.c b/remote-curl.c
index 0290b04891..1fe1f3c475 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -434,7 +434,8 @@ static void check_smart_http(struct discovery *d, const char *service,
 		 * be handled elsewhere.
 		 */
 		d->proto_git = 1;
-
+	} else if (!strcmp(reader.line, "version 1")) {
+		die(_("v1 is just the original protocol with a version string, use v0 or v2 instead."));
 	} else {
 		die(_("invalid server response; got '%s'"), reader.line);
 	}
-- 
2.30.0.1006.g4a81e96670


       reply	other threads:[~2021-03-24  5:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210324053648.25584-1-lilinchao@oschina.cn>
2021-03-24  5:36 ` lilinchao [this message]
2021-03-24 20:28   ` [PATCH 2/2] remote-curl.c: handle v1 when check_smart_http Junio C Hamano
2021-03-24 20:33     ` Junio C Hamano
     [not found]     ` <388751448ce011ebaaead4ae5278bc1265898@pobox.com>
2021-03-25  4:22       ` lilinchao
2021-03-26  6:24     ` Jeff King
2021-03-26  6:55       ` Jeff King
     [not found]     ` <e4d6bef08dfb11eb90f0a4badb2c2b1115536@peff.net>
2021-03-29  9:30       ` lilinchao
2021-03-29 10:40         ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=006547b28c6311eb93820024e87935e7@oschina.cn \
    --to=lilinchao@oschina.cn \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).