00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "internal.h"
00022
00023 static void test(const char *base, const char *rel)
00024 {
00025 char buf[200], buf2[200];
00026 ff_make_absolute_url(buf, sizeof(buf), base, rel);
00027 printf("%s\n", buf);
00028 if (base) {
00029
00030 snprintf(buf2, sizeof(buf2), "%s", base);
00031 ff_make_absolute_url(buf2, sizeof(buf2), buf2, rel);
00032 if (strcmp(buf, buf2)) {
00033 printf("In-place handling of %s + %s failed\n", base, rel);
00034 exit(1);
00035 }
00036 }
00037 }
00038
00039 int main(void)
00040 {
00041 test(NULL, "baz");
00042 test("/foo/bar", "baz");
00043 test("/foo/bar", "../baz");
00044 test("/foo/bar", "/baz");
00045 test("http://server/foo/", "baz");
00046 test("http://server/foo/bar", "baz");
00047 test("http://server/foo/", "../baz");
00048 test("http://server/foo/bar/123", "../../baz");
00049 test("http://server/foo/bar/123", "/baz");
00050 test("http://server/foo/bar/123", "https://other/url");
00051 test("http://server/foo/bar?param=value/with/slashes", "/baz");
00052 test("http://server/foo/bar?param&otherparam", "?someparam");
00053 test("http://server/foo/bar", "//other/url");
00054 return 0;
00055 }