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

[PATCH 2/2] Allow use of []-wrapped addresses in git://

From
ILIlari Liusvaara <ilari.liusvaara@elisanet.fi>
Date
Jan 26, 2010, 18:24 UTC
Message-ID
<1264530282-4783-3-git-send-email-ilari.liusvaara@elisanet.fi>
In-Reply-To
<1264530282-4783-1-git-send-email-ilari.liusvaara@elisanet.fi>

Allow using "["<host>"]":<port> and "["<host>"]" notations in git:// host addresses. This is needed to be able to connect to addresses that contain ':' (e.g. numeric IPv6 addresses). Also send the host header []-wrapped so it can actually be parsed by remote end.

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
---
 connect.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/connect.c b/connect.c
index 3a12562..20054e4 100644
--- a/connect.c
+++ b/connect.c
@@ -502,12 +502,18 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
 		c = ':';
 	}
 
+	/*
+	 * Don't do destructive transforms with git:// as that
+	 * protocol code does '[]' dewrapping of its own.
+	 */
 	if (host[0] == '[') {
 		end = strchr(host + 1, ']');
 		if (end) {
-			*end = 0;
+			if (protocol != PROTO_GIT) {
+				*end = 0;
+				host++;
+			}
 			end++;
-			host++;
 		} else
 			end = host;
 	} else
-- 
1.6.6.1.439.gf06b6
Previous: Tay Ray ChuanNext: Junio C Hamano
Message 4 of 5 in “Allow using ':' in git:// hostname.”
  1. 0/2 Allow using ':' in git:// hostname.Ilari Liusvaara, Jan 26, 2010
  2. 1/2 Support addresses with ':' in git-daemonIlari Liusvaara, Jan 26, 2010
  3. Tay Ray ChuanJan 26, 2010
  4. 2/2 Allow use of []-wrapped addresses in git://Ilari Liusvaara, Jan 26, 2010
  5. Junio C HamanoJan 26, 2010

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.