summaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorIlari Liusvaara <ilari.liusvaara@elisanet.fi>2010-01-26 18:24:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-01-26 18:52:52 (GMT)
commit9aa5053d9ffc7fade885b58a34175b4907b1a4f8 (patch)
tree848f7ae58a033e39df9ce8c895735dede89fe5bd /connect.c
parente8dbd76d57806fd1305612d56d56a4cc7665c599 (diff)
downloadgit-9aa5053d9ffc7fade885b58a34175b4907b1a4f8.zip
git-9aa5053d9ffc7fade885b58a34175b4907b1a4f8.tar.gz
git-9aa5053d9ffc7fade885b58a34175b4907b1a4f8.tar.bz2
Allow use of []-wrapped addresses in git://
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/connect.c b/connect.c
index 7945e38..5145d16 100644
--- a/connect.c
+++ b/connect.c
@@ -523,12 +523,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