summaryrefslogtreecommitdiffstats
path: root/src/url.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 08:56:12 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 08:56:12 +0000
commit5fc9e0f4acbb0647b6564d091257340b4ce800f1 (patch)
tree7c2ae9ffc1d5f93f36444e153ddaed2434612f9e /src/url.c
parentReleasing progress-linux version 1.21.4-1~progress7.99u1. (diff)
downloadwget-5fc9e0f4acbb0647b6564d091257340b4ce800f1.tar.xz
wget-5fc9e0f4acbb0647b6564d091257340b4ce800f1.zip
Merging upstream version 1.24.5.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/url.c')
-rw-r--r--src/url.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/url.c b/src/url.c
index 2ff0b55..69e948b 100644
--- a/src/url.c
+++ b/src/url.c
@@ -1,5 +1,5 @@
/* URL handling.
- Copyright (C) 1996-2011, 2015, 2018-2023 Free Software Foundation,
+ Copyright (C) 1996-2011, 2015, 2018-2024 Free Software Foundation,
Inc.
This file is part of GNU Wget.
@@ -2525,6 +2525,33 @@ test_are_urls_equal(void)
return NULL;
}
+const char *
+test_uri_merge(void)
+{
+ static const struct test_data {
+ const char *url;
+ const char *link;
+ const char *expected;
+ } test_data[] = {
+ { "http://www.yoyodyne.com/path/", "somepage.html", "http://www.yoyodyne.com/path/somepage.html" },
+ { "http://example.com/path/", "//other.com/somepage.html", "http://other.com/somepage.html" },
+ { "https://example.com/path/", "//other.com/somepage.html", "https://other.com/somepage.html" },
+ };
+
+ for (unsigned i = 0; i < countof(test_data); ++i)
+ {
+ const struct test_data *t = &test_data[i];
+ char *result = uri_merge (t->url, t->link);
+ bool ok = strcmp (result, t->expected) == 0;
+ if (!ok)
+ return aprintf ("test_uri_merge [%u]: expected '%s', got '%s'", i, t->expected, result);
+
+ xfree (result);
+ }
+
+ return NULL;
+}
+
#endif /* TESTING */
/*