gboolean valid = midori_uri_is_location (uri);
if (!valid && g_object_get_data (G_OBJECT (entry), "allow_%s"))
valid = uri && g_str_has_prefix (uri, "%s");
+ if (!valid)
+ valid = midori_uri_is_ip_address (uri);
#if GTK_CHECK_VERSION (3, 2, 0)
g_object_set_data (G_OBJECT (entry), "invalid", GINT_TO_POINTER (*uri && !valid));
we'd have to separate the path from the URI first. */
if (uri == null)
return false;
+ /* Skip leading user/ password */
+ if (uri.chr (-1, '@') != null)
+ return is_ip_address (uri.split ("@")[1]);
/* IPv4 */
if (uri[0].isdigit () && (uri.chr (4, '.') != null))
return true;
label = gtk_label_new (_("Hostname"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
INDENTED_ADD (label);
- entry = katze_property_proxy (settings, "http-proxy", NULL);
+ entry = katze_property_proxy (settings, "http-proxy", "address");
SPANNED_ADD (entry);
g_signal_connect (settings, "notify::proxy-type",
G_CALLBACK (midori_preferences_notify_proxy_type_cb), entry);
g_assert_cmpint (midori_uri_get_fingerprint (uri, NULL, NULL), ==, G_MAXINT);
}
+static void
+magic_uri_ip (void)
+{
+ g_assert (midori_uri_is_ip_address ("192.168.1.1"));
+ g_assert (midori_uri_is_ip_address ("192.168.1.1:1234"));
+ g_assert (midori_uri_is_ip_address ("user@192.168.1.1"));
+ g_assert (midori_uri_is_ip_address ("user:password@192.168.1.1"));
+ g_assert (midori_uri_is_ip_address ("2001:0db8:85a3:0000:0000:8a2e:0370:7334"));
+ g_assert (midori_uri_is_ip_address ("fe80:0:0:0:202:b3ff:fe1e:8329"));
+ g_assert (midori_uri_is_ip_address ("fe80::202:b3ff:fe1e:8329"));
+ g_assert (midori_uri_is_ip_address ("fe80::76e5:bff:fe04:38e0/64"));
+}
+
static void
magic_uri_format (void)
{
g_test_add_func ("/magic-uri/pseudo", magic_uri_pseudo);
g_test_add_func ("/magic-uri/performance", magic_uri_performance);
g_test_add_func ("/magic-uri/fingerprint", magic_uri_fingerprint);
+ g_test_add_func ("/magic-uri/ip", magic_uri_ip);
g_test_add_func ("/magic-uri/format", magic_uri_format);
g_test_add_func ("/magic-uri/prefetch", magic_uri_prefetch);
g_test_add_func ("/magic-uri/commands", magic_uri_commands);