diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-03-01 19:25:38 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-03-01 19:28:15 +0100 |
commit | d739b01b9f20b1a7fd4b313b28e4dd4e5edd9193 (patch) | |
tree | 726ebc3307905cbd1ebb062e3fc1b14e785ff2d1 /sal/qa | |
parent | 58f033569aedbeb2d6bc9d8e903b3f5a63c99614 (diff) |
Adapt rtl_uriConvertRelToAbs to RFC 3986
...which updates RFC 2396, removes the requirement that the base URI's path
starts with a slash, and clarifies how to treat excess "." and ".." segments.
This nicely allows handling of those odd vnd.sun.star.Package URLs as intended
now, so that making <foo> absolute relative to base URL
<vnd.sun.star.Package:Pictures/bar> yields <vnd.sun.star.Package:Pictures/foo>
instead of provoking a MalformedUriException.
Change-Id: Ice84303a57698a2c05d3a45541fe78b67450fa3c
Diffstat (limited to 'sal/qa')
-rw-r--r-- | sal/qa/rtl/uri/rtl_testuri.cxx | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sal/qa/rtl/uri/rtl_testuri.cxx b/sal/qa/rtl/uri/rtl_testuri.cxx index b230d4303b22..fce4aa5d0c5d 100644 --- a/sal/qa/rtl/uri/rtl_testuri.cxx +++ b/sal/qa/rtl/uri/rtl_testuri.cxx @@ -279,14 +279,14 @@ void Test::test_Uri() { char const * pAbs; }; static RelToAbsTest const aRelToAbsTest[] - = { // The following tests are taken from RFC 2396: + = { // The following tests are taken from RFC 3986: { "http://a/b/c/d;p?q", "g:h", "g:h" }, { "http://a/b/c/d;p?q", "g", "http://a/b/c/g" }, { "http://a/b/c/d;p?q", "./g", "http://a/b/c/g" }, { "http://a/b/c/d;p?q", "g/", "http://a/b/c/g/" }, { "http://a/b/c/d;p?q", "/g", "http://a/g" }, { "http://a/b/c/d;p?q", "//g", "http://g" }, - { "http://a/b/c/d;p?q", "?y", "http://a/b/c/?y" }, + { "http://a/b/c/d;p?q", "?y", "http://a/b/c/d;p?y" }, { "http://a/b/c/d;p?q", "g?y", "http://a/b/c/g?y" }, { "http://a/b/c/d;p?q", "#s", "http://a/b/c/d;p?q#s" }, { "http://a/b/c/d;p?q", "g#s", "http://a/b/c/g#s" }, @@ -294,6 +294,7 @@ void Test::test_Uri() { { "http://a/b/c/d;p?q", ";x", "http://a/b/c/;x" }, { "http://a/b/c/d;p?q", "g;x", "http://a/b/c/g;x" }, { "http://a/b/c/d;p?q", "g;x?y#s", "http://a/b/c/g;x?y#s" }, + { "http://a/b/c/d;p?q", "", "http://a/b/c/d;p?q" }, { "http://a/b/c/d;p?q", ".", "http://a/b/c/" }, { "http://a/b/c/d;p?q", "./", "http://a/b/c/" }, { "http://a/b/c/d;p?q", "..", "http://a/b/" }, @@ -302,11 +303,10 @@ void Test::test_Uri() { { "http://a/b/c/d;p?q", "../..", "http://a/" }, { "http://a/b/c/d;p?q", "../../", "http://a/" }, { "http://a/b/c/d;p?q", "../../g", "http://a/g" }, - { "http://a/b/c/d;p?q", "", "http://a/b/c/d;p?q" }, - { "http://a/b/c/d;p?q", "../../../g", "http://a/../g" }, - { "http://a/b/c/d;p?q", "../../../../g", "http://a/../../g" }, - { "http://a/b/c/d;p?q", "/./g", "http://a/./g" }, - { "http://a/b/c/d;p?q", "/../g", "http://a/../g" }, + { "http://a/b/c/d;p?q", "../../../g", "http://a/g" }, + { "http://a/b/c/d;p?q", "../../../../g", "http://a/g" }, + { "http://a/b/c/d;p?q", "/./g", "http://a/g" }, + { "http://a/b/c/d;p?q", "/../g", "http://a/g" }, { "http://a/b/c/d;p?q", "g.", "http://a/b/c/g." }, { "http://a/b/c/d;p?q", ".g", "http://a/b/c/.g" }, { "http://a/b/c/d;p?q", "g..", "http://a/b/c/g.." }, @@ -322,13 +322,15 @@ void Test::test_Uri() { { "http://a/b/c/d;p?q", "g#s/./x", "http://a/b/c/g#s/./x" }, { "http://a/b/c/d;p?q", "g#s/../x", "http://a/b/c/g#s/../x" }, { "http://a/b/c/d;p?q", "http:g", "http:g" }, + { "http!://a/b/c/d;p?q", "g:h", "g:h" }, { "http!://a/b/c/d;p?q", "g", 0 }, { "http:b/c/d;p?q", "g:h", "g:h" }, - { "http:b/c/d;p?q", "g", 0 }, - { "http://a/b/../", "../c", "http://a/b/../../c" }, + { "http:b/c/d;p?q", "g", "http:b/c/g" }, + { "http://a/b/../", "../c", "http://a/c" }, { "http://a/b/..", "../c", "http://a/c" }, - { "http://a/./b/", ".././.././../c", "http://a/./../../c" } }; + { "http://a/./b/", ".././.././../c", "http://a/c" }, + { "http://a", "b", "http://a/b" } }; for (std::size_t i = 0; i < sizeof aRelToAbsTest / sizeof (RelToAbsTest); ++i) { rtl::OUString aAbs; |