summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorDaniel Carl <danielcarl@gmx.de>2019-03-25 00:07:52 +0100
committerDaniel Carl <danielcarl@gmx.de>2019-03-25 00:17:46 +0100
commitd18c51fdf0f99ebbe78d916032fcbbf7cdec4b25 (patch)
treea92e0d086feba8457f2dfc1716e87c187073a7ba /src/util.c
parent34dce1c5d2ad4d4eb94e863358250a6053eff7dc (diff)
Use webkit_uri_for_display().
Use this function for shown url for IDN homograph mitigation.
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/util.c b/src/util.c
index e22bb1d..a6fd4cc 100644
--- a/src/util.c
+++ b/src/util.c
@@ -827,16 +827,24 @@ char *util_sanitize_uri(const char *uri_str)
{
SoupURI *uri;
char *sanitized_uri;
+ char *for_display;
+
+#if WEBKIT_CHECK_VERSION(2, 24, 0)
+ for_display = webkit_uri_for_display(uri_str);
+#else
+ for_display = g_strdup(uri_str);
+#endif
/* Sanitize the uri only in case there is a @ which might be the indicator
* for credentials used in uri. */
- if (!strchr(uri_str, '@')) {
- return g_strdup(uri_str);
+ if (!strchr(for_display, '@')) {
+ return for_display;
}
- uri = soup_uri_new(uri_str);
+ uri = soup_uri_new(for_display);
sanitized_uri = soup_uri_to_string(uri, FALSE);
soup_uri_free(uri);
+ g_free(for_display);
return sanitized_uri;
}