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>
Ilari Liusvaara committed
Jan 26, 2010 at 20:24 UTC
9aa5053d9ffc7fade885b58a34175b4907b1a4f8
1 file changed
+8
-2
connect.c
+8
-2
@@ -523,12 +523,18 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
523
c = ':';
524
}
525
526
+ /*
527
+ * Don't do destructive transforms with git:// as that
528
+ * protocol code does '[]' dewrapping of its own.
529
+ */
530
if (host[0] == '[') {
531
end = strchr(host + 1, ']');
532
if (end) {
529
- *end = 0;
533
+ if (protocol != PROTO_GIT) {
534
+ *end = 0;
535
+ host++;
536
+ }
537
end++;
531
- host++;
538
} else
539
end = host;
540
} else