aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorXan Lopez <xan@igalia.com>2012-01-25 03:33:02 +0800
committerXan Lopez <xan@igalia.com>2012-01-25 03:33:02 +0800
commit5bcbe1bec4751bec10e086a74564475ee9d1533e (patch)
treee26a05cf64d4695e4c3f3d2528c356a039b4fe21 /embed
parent22f2e807d040d2d0f51e53e1f022a40d82fc1a24 (diff)
downloadgsoc2013-epiphany-5bcbe1bec4751bec10e086a74564475ee9d1533e.tar
gsoc2013-epiphany-5bcbe1bec4751bec10e086a74564475ee9d1533e.tar.gz
gsoc2013-epiphany-5bcbe1bec4751bec10e086a74564475ee9d1533e.tar.bz2
gsoc2013-epiphany-5bcbe1bec4751bec10e086a74564475ee9d1533e.tar.lz
gsoc2013-epiphany-5bcbe1bec4751bec10e086a74564475ee9d1533e.tar.xz
gsoc2013-epiphany-5bcbe1bec4751bec10e086a74564475ee9d1533e.tar.zst
gsoc2013-epiphany-5bcbe1bec4751bec10e086a74564475ee9d1533e.zip
ephy-embed-utils: load again stuff like 'localhost:3000"
https://bugzilla.gnome.org/show_bug.cgi?id=668593
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed-utils.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c
index 5acef0baa..2d58fc68b 100644
--- a/embed/ephy-embed-utils.c
+++ b/embed/ephy-embed-utils.c
@@ -107,13 +107,23 @@ char*
ephy_embed_utils_normalize_address (const char *address)
{
char *effective_address = NULL;
- char *scheme = NULL;
+ SoupURI *uri;
g_return_val_if_fail (address, NULL);
- scheme = g_uri_parse_scheme (address);
-
- if (scheme == NULL)
+ uri = soup_uri_new (address);
+
+ /* FIXME: if we are here we passed through the "should we
+ * auto-search this?" regex in EphyWebView, so we should be a
+ * valid-ish URL. Auto-prepend http:// to anything that is not
+ * one according to soup, because it probably will be
+ * something like "google.com". Special case localhost(:port),
+ * because SoupURI, correctly, thinks it is a URI with scheme
+ * being localhost and, optionally, path being the
+ * port. Ideally we should check if we have a handler for the
+ * scheme, and since we'll fail for localhost, we'd fallback
+ * to loading it as a domain. */
+ if (!uri || (uri && !g_strcmp0 (uri->scheme, "localhost")))
effective_address = g_strconcat ("http://", address, NULL);
else {
/* Convert about: schemes to ephy-about: in order to
@@ -128,7 +138,8 @@ ephy_embed_utils_normalize_address (const char *address)
effective_address = g_strdup (address);
}
- g_free (scheme);
+ if (uri)
+ soup_uri_free (uri);
return effective_address;
}