This source file includes following definitions.
- test
- main
#include "url.h"
static void test(const char *base, const char *rel)
{
char buf[200], buf2[200];
ff_make_absolute_url(buf, sizeof(buf), base, rel);
printf("%s\n", buf);
if (base) {
snprintf(buf2, sizeof(buf2), "%s", base);
ff_make_absolute_url(buf2, sizeof(buf2), buf2, rel);
if (strcmp(buf, buf2)) {
printf("In-place handling of %s + %s failed\n", base, rel);
exit(1);
}
}
}
int main(void)
{
test(NULL, "baz");
test("/foo/bar", "baz");
test("/foo/bar", "../baz");
test("/foo/bar", "/baz");
test("http://server/foo/", "baz");
test("http://server/foo/bar", "baz");
test("http://server/foo/", "../baz");
test("http://server/foo/bar/123", "../../baz");
test("http://server/foo/bar/123", "/baz");
test("http://server/foo/bar/123", "https://other/url");
test("http://server/foo/bar?param=value/with/slashes", "/baz");
test("http://server/foo/bar?param&otherparam", "?someparam");
test("http://server/foo/bar", "//other/url");
return 0;
}