[epiphany] Ignore case of URL schemes
- From: Xan Lopez <xan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Ignore case of URL schemes
- Date: Wed, 7 Apr 2010 09:14:13 +0000 (UTC)
commit 4abc19223f8e8678e62148772215522dc5396448
Author: Jose Millan Soto <jmillan igalia com>
Date: Wed Apr 7 11:12:28 2010 +0200
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>
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 3463f2d..e163680 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]