summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/net.c5
-rw-r--r--src/net.h3
2 files changed, 8 insertions, 0 deletions
diff --git a/src/net.c b/src/net.c
index d5662393a..d4a9f8a6d 100644
--- a/src/net.c
+++ b/src/net.c
@@ -345,6 +345,11 @@ bool git_net_url_is_default_port(git_net_url *url)
return false;
}
+bool git_net_url_is_ipv6(git_net_url *url)
+{
+ return (strchr(url->host, ':') != NULL);
+}
+
void git_net_url_swap(git_net_url *a, git_net_url *b)
{
git_net_url tmp = GIT_NET_URL_INIT;
diff --git a/src/net.h b/src/net.h
index 0082dd6d7..391b99a9f 100644
--- a/src/net.h
+++ b/src/net.h
@@ -36,6 +36,9 @@ extern bool git_net_url_valid(git_net_url *url);
/** Returns true if the URL is on the default port. */
extern bool git_net_url_is_default_port(git_net_url *url);
+/** Returns true if the host portion of the URL is an ipv6 address. */
+extern bool git_net_url_is_ipv6(git_net_url *url);
+
/* Applies a redirect to the URL with a git-aware service suffix. */
extern int git_net_url_apply_redirect(
git_net_url *url,