aboutsummaryrefslogtreecommitdiffstats
path: root/connect.c
diff options
context:
space:
mode:
authorTorsten Bögershausen <tboegi@web.de>2015-04-07 22:03:25 +0200
committerJunio C Hamano <gitster@pobox.com>2015-04-08 21:00:53 -0700
commit6b6c5f7a2f66751a93afce54277a1f30ab0dc521 (patch)
tree3bf6a8b079e1853105d4eec87126756c57fd3273 /connect.c
parent3f55ccab8e0fec73c8e38b909e9bb4963bfb8f6a (diff)
downloadgit-6b6c5f7a2f66751a93afce54277a1f30ab0dc521.tar.gz
connect.c: ignore extra colon after hostname
Ignore an extra ':' at the end of the hostname in URL's like "ssh://example.com:/path/to/repo" The colon is meant to separate a port number from the hostname. If the port is empty, the colon should be ignored, see RFC 3986. It had been working for URLs with ssh:// scheme, but was unintentionally broken in 86ceb3, "allow ssh://user@[2001:db8::1]/repo.git" Reported-by: Reid Woodbury Jr. <reidw@rawsound.com> Signed-off-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/connect.c b/connect.c
index 84f8156a4c..dc31b795e7 100644
--- a/connect.c
+++ b/connect.c
@@ -311,6 +311,8 @@ static void get_host_and_port(char **host, const char **port)
if (end != colon + 1 && *end == '\0' && 0 <= portnr && portnr < 65536) {
*colon = 0;
*port = colon + 1;
+ } else if (!colon[1]) {
+ *colon = 0;
}
}
}