[ resending because it doesn't show up in mail archive ]

URISupport::getURLStringFromString() does not behave correctly if the
url begins with a slash.  For example, 

url: /baz
base url: http://hostname.com/foo/bar

the fully qualified url should be http://hostname.com/baz.  The
function in the current release gives http://hostname.com/foo//baz.

============= CUT HERE ===========================
--- xml-xalan/c/src/PlatformSupport/URISupport.cpp    Mon Nov 25 16:10:15 2002
+++ xml-xalan/c/src/PlatformSupport/URISupport.cpp    Wed Jun 18 16:12:39 2003
@@ -226,8 +226,29 @@
 
        // Is there a colon, indicating some sort of drive spec, or protocol?
        const XalanDOMString::size_type         theColonIndex = indexOf(urlString, 
XalanUnicode::charColon);
-
-       if (theColonIndex == urlStringLen)
+       if (urlString[0] == XalanUnicode::charSolidus)
+        {
+               // if the first character of the url is a slash, 
+               // we want to get rid of the entire path and 
+               // retain the host name or drive name in the base url
+               const XalanDOMString::size_type      theBaseColonIndex = 
indexOf(context, XalanUnicode::charColon);
+               if (theBaseColonIndex < baseLen) { 
+                 XalanDOMString::size_type cursor = theBaseColonIndex+1;
+                 // skip all the consecutive slashes after the colon
+                 while (cursor < baseLen && context[cursor] == 
XalanUnicode::charSolidus) {
+                   cursor++;
+                 }
+                 // skip the host name or drive name and get to the next slash
+                 while (cursor < baseLen && context[cursor] != 
XalanUnicode::charSolidus) {
+                   cursor++;
+                 }
+                 substring(context, context, 0, cursor);
+                 context += urlString;
+               } else {
+                 context = urlString;
+               }
+        }
+       else if (theColonIndex == urlStringLen)
        {
                // No colon, so just use the urlString as is...
                if (hasPath == true)
============= CUT HERE ===========================

Reply via email to