diff options
author | Xan Lopez <xan@igalia.com> | 2012-01-25 03:33:02 +0800 |
---|---|---|
committer | Xan Lopez <xan@igalia.com> | 2012-01-25 03:33:02 +0800 |
commit | 5bcbe1bec4751bec10e086a74564475ee9d1533e (patch) | |
tree | e26a05cf64d4695e4c3f3d2528c356a039b4fe21 /embed/ephy-embed-utils.c | |
parent | 22f2e807d040d2d0f51e53e1f022a40d82fc1a24 (diff) | |
download | gsoc2013-epiphany-5bcbe1bec4751bec10e086a74564475ee9d1533e.tar.gz 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/ephy-embed-utils.c')
-rw-r--r-- | embed/ephy-embed-utils.c | 21 |
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; } |