DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20928>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20928 proposed patch to fix URISupport::getURLStringFromString() Summary: proposed patch to fix URISupport::getURLStringFromString() Product: XalanC Version: 1.5 Platform: All OS/Version: All Status: NEW Severity: Normal Priority: Other Component: XalanC AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] 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 ===========================
