guri: Improve performance of remove_dot_segments() algorithm

This commit is contained in:
Sebastian Wilhelmi
2021-11-17 15:20:28 +00:00
committed by Philip Withnall
parent 927c7e4e58
commit 21b45d6ac2
2 changed files with 85 additions and 47 deletions

View File

@@ -898,6 +898,19 @@ static const UriRelativeTest relative_tests[] = {
{ "ScHeMe://User:P%61ss@HOST.%63om:1234/path/./from/../to%7d/item%2dobj?qu%65ry=something#fr%61gment",
"scheme://User:Pass@HOST.com:1234/path/to%7D/item-obj?query=something#fragment",
{ "scheme", "User:Pass", "HOST.com", 1234, "/path/to}/item-obj", "query=something", "fragment" } },
/* Test corner cases of remove_dot_segments */
{ "http:..", "http:",
{ "http", NULL, NULL, -1, "", NULL, NULL } },
{ "http:../", "http:",
{ "http", NULL, NULL, -1, "", NULL, NULL } },
{ "http:.", "http:",
{ "http", NULL, NULL, -1, "", NULL, NULL } },
{ "http:./", "http:",
{ "http", NULL, NULL, -1, "", NULL, NULL } },
{ "http:a/..", "http:/",
{ "http", NULL, NULL, -1, "/", NULL, NULL } },
{ "http:a/../", "http:/",
{ "http", NULL, NULL, -1, "/", NULL, NULL } },
};
static int num_relative_tests = G_N_ELEMENTS (relative_tests);