Commit 27301cd0 by Edward Thomson

net: function to identify ipv6 addresses in URLs

parent 953dee20
...@@ -345,6 +345,11 @@ bool git_net_url_is_default_port(git_net_url *url) ...@@ -345,6 +345,11 @@ bool git_net_url_is_default_port(git_net_url *url)
return false; 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) void git_net_url_swap(git_net_url *a, git_net_url *b)
{ {
git_net_url tmp = GIT_NET_URL_INIT; git_net_url tmp = GIT_NET_URL_INIT;
......
...@@ -36,6 +36,9 @@ extern bool git_net_url_valid(git_net_url *url); ...@@ -36,6 +36,9 @@ extern bool git_net_url_valid(git_net_url *url);
/** Returns true if the URL is on the default port. */ /** Returns true if the URL is on the default port. */
extern bool git_net_url_is_default_port(git_net_url *url); 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. */ /* Applies a redirect to the URL with a git-aware service suffix. */
extern int git_net_url_apply_redirect( extern int git_net_url_apply_redirect(
git_net_url *url, git_net_url *url,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment