mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 11:26:16 +01:00
guri: add some IPv6 scope-id tests
Add a few ipv6 scope parsing corner test cases. - checking incorrect scoped IPv6 ending with only %25 isn't decoded. - checking valid scoped IPv6 is passing g_uri_is_valid() As discussed in https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1567#note_860499, for historical reasons, GUri accepts the % preceding the zone-id in the unescaped form as well. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
dd0fae1303
commit
0fea3d71e4
@ -703,6 +703,8 @@ static const UriAbsoluteTest absolute_tests[] = {
|
||||
{ "http", NULL, "fe80::dead:beef%em1", -1, "/", NULL, NULL } },
|
||||
{ "http://[fe80::dead:beef%10]/",
|
||||
{ "http", NULL, "fe80::dead:beef%10", -1, "/", NULL, NULL } },
|
||||
{ "http://[fe80::dead:beef%25]/",
|
||||
{ "http", NULL, "fe80::dead:beef%25", -1, "/", NULL, NULL } },
|
||||
};
|
||||
static int num_absolute_tests = G_N_ELEMENTS (absolute_tests);
|
||||
|
||||
@ -1275,6 +1277,7 @@ test_uri_is_valid (void)
|
||||
g_assert_error (error, G_URI_ERROR, G_URI_ERROR_BAD_HOST);
|
||||
g_clear_error (&error);
|
||||
|
||||
g_assert_true (g_uri_is_valid ("http://[fe80::dead:beef%25wef]/", G_URI_FLAGS_NONE, NULL));
|
||||
g_assert_false (g_uri_is_valid ("http://[fe80::dead:beef%wef%]/", G_URI_FLAGS_NONE, &error));
|
||||
g_assert_error (error, G_URI_ERROR, G_URI_ERROR_BAD_HOST);
|
||||
g_clear_error (&error);
|
||||
|
Loading…
Reference in New Issue
Block a user