You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Joel Roth-Nater <jr...@quoininc.com> on 2000/09/01 20:34:00 UTC

Bug in XMLURL::makeRelativeTo()?

I am perusing the XMLURL class to resolve URLs embedded in XML.
It seems to me that the way relative URLs are computed is in
conflict with RFC 2396. Currently the following pseudocode


  XMLURL u( "index.html" );
  u.makeRelativeTo( "http://www.w3c.org/web/" );


results in u pointing to "http://www.w3c.org/index.html".
The last segment of the base URL is discarded regardless of the
trailing '/', and I wonder why.

According to the RFCs definition of a path

  path          = [ abs_path | opaque_part ]
  path_segments = segment *( "/" segment )
  segment       = *pchar *( ";" param )
  param         = *pchar
  pchar         = unreserved | escaped |
                  ":" | "@" | "&" | "=" | "+" | "$" | ","

"http://www.w3c.org/web/" should be interpreted as pointing
to an empty-named document inside the directory "web", and
the combined URL should be "http://www.w3c.org/web/index.html".
This would also be consistent with the implementation of
most browsers.

Am I missing something here? Are URLs supposed to be used to 
point at documents only - and not directories?

Any insight would be greatly appreciated -- Joel

======================================================
 Joel Roth-Nater              jrothnater@quoininc.com
 Quoin Inc.                   tel +1-617-737-1820
 695 Atlantic Ave, Floor 3    fax +1-617-737-1821
 Boston MA 02111-2623         http://www.quoininc.com
======================================================

Save the whales. Feed the hungry. Free the mallocs.

Re: Bug in XMLURL::makeRelativeTo()?

Posted by Dean Roddey <dr...@charmedquark.com>.
If that is happening, then it certainly is a bug since wasn't intended to
work that way. The only thing that should throw away trailing components of
the path are .. bits in the trailing part being made relative.

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"It takes two buttocks to make friction"
    - African Proverb


----- Original Message -----
From: "Joel Roth-Nater" <jr...@quoininc.com>
To: <xe...@xml.apache.org>
Sent: Friday, September 01, 2000 11:34 AM
Subject: Bug in XMLURL::makeRelativeTo()?


> I am perusing the XMLURL class to resolve URLs embedded in XML.
> It seems to me that the way relative URLs are computed is in
> conflict with RFC 2396. Currently the following pseudocode
>
>
>   XMLURL u( "index.html" );
>   u.makeRelativeTo( "http://www.w3c.org/web/" );
>
>
> results in u pointing to "http://www.w3c.org/index.html".
> The last segment of the base URL is discarded regardless of the
> trailing '/', and I wonder why.
>
> According to the RFCs definition of a path
>
>   path          = [ abs_path | opaque_part ]
>   path_segments = segment *( "/" segment )
>   segment       = *pchar *( ";" param )
>   param         = *pchar
>   pchar         = unreserved | escaped |
>                   ":" | "@" | "&" | "=" | "+" | "$" | ","
>
> "http://www.w3c.org/web/" should be interpreted as pointing
> to an empty-named document inside the directory "web", and
> the combined URL should be "http://www.w3c.org/web/index.html".
> This would also be consistent with the implementation of
> most browsers.
>
> Am I missing something here? Are URLs supposed to be used to
> point at documents only - and not directories?
>
> Any insight would be greatly appreciated -- Joel
>
> ======================================================
>  Joel Roth-Nater              jrothnater@quoininc.com
>  Quoin Inc.                   tel +1-617-737-1820
>  695 Atlantic Ave, Floor 3    fax +1-617-737-1821
>  Boston MA 02111-2623         http://www.quoininc.com
> ======================================================
>
> Save the whales. Feed the hungry. Free the mallocs.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>