t { assert(applyRelativeURL("http://example.com/", "index.html") == "http://example.com/index.html"); assert(applyRelativeURL("http://example.com/index.html", "page.html") == "http://example.com/page.html"); assert(applyRelativeURL("http://example.com/dir/index.html", "page.html") == "http://example.com/dir/page.html"); assert(applyRelativeURL("http://example.com/dir/index.html", "/page.html") == "http://example.com/page.html"); assert(applyRelativeURL("http://example.com/dir/index.html", "../page.html") == "http://example.com/page.html"); assert(applyRelativeURL("http://example.com/script.php?path=a/b/c", "page.html") == "http://example.com/page.html"); assert(applyRelativeURL("http://example.com/index.html", "http://example.org/page.html") == "http://example.org/page.html"); assert(applyRelativeURL("http://example.com/http://archived.website", "/http://archived.website/2") == "http://example.com/http://archived.website/2"
Calculate the full URL given a base and a target relative URL.