diff options
author | Jose Millan Soto <jmillan@igalia.com> | 2010-04-07 17:12:28 +0800 |
---|---|---|
committer | Xan Lopez <xan@gnome.org> | 2010-04-07 17:13:53 +0800 |
commit | 4abc19223f8e8678e62148772215522dc5396448 (patch) | |
tree | e99d6d88fdfe9140c3135a64afd73c8e4779dd03 /embed/ephy-embed-utils.c | |
parent | 21250dde74250883831a107821bb23fc0232e160 (diff) | |
download | gsoc2013-epiphany-4abc19223f8e8678e62148772215522dc5396448.tar.gz gsoc2013-epiphany-4abc19223f8e8678e62148772215522dc5396448.tar.zst gsoc2013-epiphany-4abc19223f8e8678e62148772215522dc5396448.zip |
Ignore case of URL schemes
We only accept lowercase schemes right now, for no good reason.
Bug #605089
Signed-off-by: Xan Lopez <xan@gnome.org>
Diffstat (limited to 'embed/ephy-embed-utils.c')
-rw-r--r-- | embed/ephy-embed-utils.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c index 3463f2d52..e163680be 100644 --- a/embed/ephy-embed-utils.c +++ b/embed/ephy-embed-utils.c @@ -81,18 +81,23 @@ gboolean ephy_embed_utils_address_has_web_scheme (const char *address) { gboolean has_web_scheme; + int colonpos; if (address == NULL) return FALSE; - has_web_scheme = (g_str_has_prefix (address, "http:") || - g_str_has_prefix (address, "https:") || - g_str_has_prefix (address, "ftp:") || - g_str_has_prefix (address, "file:") || - g_str_has_prefix (address, "data:") || - g_str_has_prefix (address, "about:") || - g_str_has_prefix (address, "javascript:") || - g_str_has_prefix (address, "mailto:") || - g_str_has_prefix (address, "gopher:")); + colonpos = (int)((g_strstr_len (address, 11, ":")) - address); + + if (colonpos < 0) return FALSE; + + has_web_scheme = !(g_ascii_strncasecmp (address, "http", colonpos) && + g_ascii_strncasecmp (address, "https", colonpos) && + g_ascii_strncasecmp (address, "ftp", colonpos) && + g_ascii_strncasecmp (address, "file", colonpos) && + g_ascii_strncasecmp (address, "javascript", colonpos) && + g_ascii_strncasecmp (address, "data", colonpos) && + g_ascii_strncasecmp (address, "about", colonpos) && + g_ascii_strncasecmp (address, "gopher", colonpos) && + g_ascii_strncasecmp (address, "mailto", colonpos)); return has_web_scheme; } |