From d739b01b9f20b1a7fd4b313b28e4dd4e5edd9193 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Sat, 1 Mar 2014 19:25:38 +0100 Subject: 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 absolute relative to base URL yields instead of provoking a MalformedUriException. Change-Id: Ice84303a57698a2c05d3a45541fe78b67450fa3c --- include/rtl/uri.h | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) (limited to 'include/rtl') diff --git a/include/rtl/uri.h b/include/rtl/uri.h index a4e1d378efe4..248a0d42b55f 100644 --- a/include/rtl/uri.h +++ b/include/rtl/uri.h @@ -294,39 +294,27 @@ SAL_DLLPUBLIC void SAL_CALL rtl_uriDecode( rtl_uString ** pResult) SAL_THROW_EXTERN_C(); -/** Convert a relative URI reference into an absolute one. +/** Convert a relative URI reference into an absolute URI. - A URI reference is a URI plus an optional @<"#" fragment> part. - - This function uses the algorithm described in RFC 2396, section 5.2, with - the following clarifications: (1) Backwards-compatible relative URIs - starting with a scheme component (see RFC 2396, section 5.2, step 3) are not - supported. (2) Segments "." and ".." within the path of the base URI are - not considered special, RFC 2396 seems a bit unlcear about that point. - (3) Erroneous excess segments ".." within the path of the relative URI (if - it is indeed relative) are left intact, as the examples in RFC 2396, - section C.2, suggest. (4) If the relative URI is a reference to the - "current document," the "current document" is taken to be the base URI. + This function uses the strict parser algorithm described in RFC 3986, + section 5.2. This function signals exceptions by returning false and letting pException point to a message explaining the exception. @param pBaseUriRef - An absolute, hierarchical URI reference that serves as the base URI. If it - has to be inspected (i.e., pRelUriRef is not an absolute URI already), and - if it either is not an absolute URI (i.e., does not begin with a - @ part) or has a path that is non-empty but does not start - with "/", an exception will be signaled. + An absolute URI that serves as the base URI. If it has to be inspected + (i.e., pRelUriRef is not an absolute URI already), and it is not an absolute + URI (i.e., does not begin with a @ part), an exception will be + signaled. @param pRelUriRef An URI reference that may be either absolute or relative. If it is - absolute, it will be returned unmodified (and it need not be hierarchical - then). + absolute, it will be returned unmodified. @param pResult - Returns an absolute URI reference. Must itself not be null, and must point - to either null or a valid string. If an exception is signalled, it is left - unchanged. + Returns an absolute URI. Must itself not be null, and must point to either + null or a valid string. If an exception is signalled, it is left unchanged. @param pException Returns an explanatory message in case an exception is signalled. Must -- cgit