git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] remote-curl.c: handle v1 when check_smart_http

From
Llilinchao@oschina.cn <lilinchao@oschina.cn>
Date
Mar 24, 2021, 05:36 UTC
Message-ID
<006547b28c6311eb93820024e87935e7@oschina.cn>
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
Next: Junio C Hamano
Message 1 of 8 in “remote-curl.c: handle v1 when check_smart_http”
  1. 2/2 remote-curl.c: handle v1 when check_smart_httplilinchao@oschina.cn, Mar 24, 2021
  2. Junio C HamanoMar 24, 2021
  3. Junio C HamanoMar 24, 2021
  4. Jeff KingMar 26, 2021
  5. Jeff KingMar 26, 2021
  6. lilinchao@oschina.cnMar 25, 2021
  7. lilinchao@oschina.cnMar 29, 2021
  8. Jeff KingMar 29, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.