You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2001/11/27 00:10:12 UTC

cvs commit: xml-xalan/c/src/PlatformSupport URISupport.cpp

dbertoni    01/11/26 15:10:12

  Modified:    c/src/PlatformSupport URISupport.cpp
  Log:
  Fix for bug 4765.
  
  Revision  Changes    Path
  1.15      +28 -14    xml-xalan/c/src/PlatformSupport/URISupport.cpp
  
  Index: URISupport.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/URISupport.cpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- URISupport.cpp	2001/09/25 21:12:51	1.14
  +++ URISupport.cpp	2001/11/26 23:10:12	1.15
  @@ -146,7 +146,7 @@
   	{
   		const XalanDOMString::size_type		index = indexOf(theNormalizedURI, XalanUnicode::charColon);
   
  -		bool				protocolPresent = false;
  +		bool	protocolPresent = false;
   
   		if (index != len)
   		{
  @@ -167,7 +167,7 @@
   		else
   		{
   			// Assume it's a file specification...
  -			XalanArrayAutoPtr<XalanDOMChar>		theFullPath(XMLPlatformUtils::getFullPath(c_wstr(urlString)));
  +			const XalanArrayAutoPtr<XalanDOMChar>	theFullPath(XMLPlatformUtils::getFullPath(c_wstr(urlString)));
   			assert(theFullPath.get() != 0);
   
   			theNormalizedURI = theFullPath.get();
  @@ -279,23 +279,37 @@
   		else
   		{
   			// It's a protocol...
  -			if (startsWith(context, theProtocolString) == true)
  +			if (startsWith(context, theProtocolString) == false)
   			{
  +				// OK, not the same protocol, so what can we do???
  +				context = urlString;
  +			}
  +			else
  +			{
   				// They share the same protocol...
  +
  +				// Check if this is an absolute URI (starts with a leading '//')
  +				const XalanDOMString::size_type		protoLength = length(theProtocolString);
   
  -				// Strip off file name from context...
  -				if (indexOfSlash < theContextLength)
  +				if (protoLength + 3 <= theURLStringLength &&
  +					urlString[protoLength + 1] == XalanUnicode::charSolidus &&
  +					urlString[protoLength + 2] == XalanUnicode::charSolidus)
   				{
  -					context = substring(context, 0, indexOfSlash + 1);
  +					// It's an absolute URI -- use it in full...
  +					context = urlString;
   				}
  -
  -				// OK, everything looks good, so strip off the protocol and colon...
  -				context += substring(urlString, theColonIndex + 1, theURLStringLength);
  -			}
  -			else
  -			{
  -				// OK, not the same protocol, so what can we do???
  -				context = urlString;
  +				else
  +				{
  +					// Strip off file name from context...
  +					if (indexOfSlash < theContextLength)
  +					{
  +						context = substring(context, 0, indexOfSlash + 1);
  +					}
  +
  +					// OK, everything looks good, so strip off the protocol 
  +					// and colon...
  +					context += substring(urlString, theColonIndex + 1, theURLStringLength);
  +				}
   			}
   		}
   	}
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org