hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Moran <mike_mo...@mac.com>
Subject Re: normalizing a URI with ..'s in it ?
Date Wed, 23 Jul 2003 22:18:13 GMT

On Wednesday, Jul 23, 2003, at 20:37 Europe/London, Michael Becke wrote:

> Mike Moran wrote:
>> Btw, I presume this is the algorithm given in section 5.2 of  
>> http://www.apache.org/~fielding/uri/rev-2002/ 
>> rfc2396bis.html#absolutize?  If so, this is just a draft  
>> (draft-fielding-uri-rfc2396bis-03.txt). It does actually differ from  
>> rfc2396 in how it handles abnormal URLs (though I think that's  
>> irrelevant here).
>
> Yes, this is the algorithm.  We decided to upgrade to ensure that URI  
> parsing was consistent across Apache.  I think this was at the request  
> of Roy Fielding.  Oleg, is that correct?

[Oleg agreed] Right. Out of interest, which set of test cases does the  
URI class use, the ones from rfc2396 or rfc2396bis?

>
>> The string "my/relative/../../another/relative" would never be output  
>> from merge() or given to remove_dot_segments() in the section 5.2  
>> algorithm. If you are just applying remove_dot_segments() to this  
>> string then it will get confused and output a wierd answer because  
>> it's not expecting that input (ie a path that doesn't have a "/" at  
>> the start).
> >
>> I may be wrong, but I didn't think normalization could be applied to  
>> anything but absolute URLs.
>
> I agree that when resolving a path relative to a base URI a relative  
> path should never be passed to remove_dot_segments().  However,  
> according to section 6.2.2.3 remove_dot_segments() can be used for  
> path segment normalization.
>
> I guess what is comes down to is that normalization is meant to  
> generate a URI with a valid absolute path.  The value output in this  
> case is a little strange but I think it's correct.  Essentially  
> normalize should not be used on relative URIs.

I would agree. Doesn't this mean that normalize() should thrown an  
exception if it *is* called on a non-absolute URI?

-- 
Mike


Mime
View raw message