aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xan@igalia.com>2012-08-17 23:25:25 +0800
committerXan Lopez <xan@igalia.com>2012-08-17 23:25:25 +0800
commitd4253831bba6bfa2268c07c42e82d8d6272a4f0e (patch)
tree1cb82eddcbba10f202f4aaf229ee8099046b6864
parent70b9a089b39208856f73e26d533d4912bb37050d (diff)
downloadgsoc2013-epiphany-d4253831bba6bfa2268c07c42e82d8d6272a4f0e.tar.gz
gsoc2013-epiphany-d4253831bba6bfa2268c07c42e82d8d6272a4f0e.tar.zst
gsoc2013-epiphany-d4253831bba6bfa2268c07c42e82d8d6272a4f0e.zip
ephy-web-view: use ephy_string_get_host_name
Saves some code duplication.
-rw-r--r--embed/ephy-web-view.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index ae99cf137..12e5f5128 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -2853,33 +2853,27 @@ ephy_web_view_new (void)
static gboolean
is_public_domain (EphyWebView *view, const char *url)
{
- SoupURI *soup_uri;
gboolean retval = FALSE;
- const char *host = NULL;
+ char *host = NULL;
EphyWebViewPrivate *priv = view->priv;
- soup_uri = soup_uri_new (url);
- if (!soup_uri) {
- char *effective_url = g_strconcat ("http://", url, NULL);
- soup_uri = soup_uri_new (effective_url);
- g_free (effective_url);
- }
- g_return_val_if_fail (soup_uri, FALSE);
-
- host = soup_uri->host;
+ host = ephy_string_get_host_name (url);
+ g_return_val_if_fail (host, FALSE);
if (g_regex_match (priv->domain_regex, host, 0, NULL)) {
if (g_str_equal (host, "localhost"))
retval = TRUE;
else {
- host = g_strrstr (host, ".");
+ const char *end;
- if (host && *host != '\0')
- retval = soup_tld_domain_is_public_suffix (host);
+ end = g_strrstr (host, ".");
+
+ if (end && *end != '\0')
+ retval = soup_tld_domain_is_public_suffix (end);
}
}
- soup_uri_free (soup_uri);
+ g_free (host);
return retval;
}